我有这样的功能:插入错误在MySQL/PHP
public static function insert_user($user)
{
$con = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("speakom",$con) or die(mysql_error());
mysql_query("INSERT INTO user (user_ip,user_name,full_name,email_address,password,gender,birthday,banned,role,country)
VALUES('".$user->ip."','".$user->name."','".$user->full_name."','".$user->email."','".$user->password."',".$user->gender.",'".$user->birthday."',".$user->banned.",".$user->role.",'".$user->country."'") or die(mysql_error());
mysql_close($con);
}
而且我得到这个错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
哪里出错点?我怎么知道错误在哪里?
谢谢。现在它的工作 –