您的SQL语法有错误;检查对应的手册

时间:2015-07-16 08:27:13

标签: php mysql

您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第2行“','')附近使用正确的语法

这个我的代码出了什么问题?

$sql = "INSERT INTO report(agent_name, date, p_title, p_fname, p_lname, p_number, address, city, state, postal_code, DoB, plan, mcn, dr_title, dr_fname, dr_lname, status, dr_npi, comment)
VALUES('$agent_name','$date','$p_title','$p_fname','$p_lname','$p_number','$address','$city','$state','$postal_code','$DoB','$plan','$mcn','$dr_title','$dr_fname','$dr_lname','$status','$dr_npi,'$comment')";

4 个答案:

答案 0 :(得分:1)

你错过了qoute ''$dr_npi,'$comment'应该是这样的: '$dr_npi','$comment'

全固定查询:

$sql = "INSERT INTO report(agent_name, date, p_title, p_fname, p_lname, p_number, address, city, state, postal_code, DoB, plan, mcn, dr_title, dr_fname, dr_lname, status, dr_npi, comment)
VALUES('$agent_name','$date','$p_title','$p_fname','$p_lname','$p_number','$address','$city','$state','$postal_code','$DoB','$plan','$mcn','$dr_title','$dr_fname','$dr_lname','$status','$dr_npi','$comment')";

答案 1 :(得分:0)

你错过了这里的引用Intent intent = getPackageManager().getLaunchIntentForPackage("com.package.name"); intent.setData(Uri.fromFile(file)); //? - set file to open startActivity(intent); ,工作查询是;

'$dr_npi,'$comment'

答案 2 :(得分:0)

将查询更改为:

$sql = "INSERT INTO report(agent_name, date, p_title, p_fname, p_lname, p_number, address, city, state, postal_code, DoB, plan, mcn, dr_title, dr_fname, dr_lname, status, dr_npi, comment)
VALUES('$agent_name','$date','$p_title','$p_fname','$p_lname','$p_number','$address','$city','$state','$postal_code','$DoB','$plan','$mcn','$dr_title','$dr_fname','$dr_lname','$status','$dr_npi','$comment')";

答案 3 :(得分:-1)

如果要正确使用SQL和PHP,则必须组合“和”

<?php
$sql = "INSERT INTO report(agent_name, date, p_title, p_fname, p_lname, p_number, address, city, state, postal_code, DoB, plan, mcn, dr_title, dr_fname, dr_lname, status, dr_npi, comment)
VALUES('".$agent_name."','".$date."','".$p_title."','".$p_fname."','".$p_lname."','".$p_number."','".$address."','".$city."','".$state."','".$postal_code."','".$DoB."','".$plan."','".$mcn."','".$dr_title."','".$dr_fname."','".$dr_lname."','".$status."','".$dr_npi."','".$comment."')";
?>

我希望这就是你需要的东西