mysql查看服务器版本sql_您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在附近使用正确的语法...

我有这样的代码将数据插入到数据库中,但即使我已经多次检查过该语法,我仍然会收到此错误,任何人都可以帮助我吗?

错误:

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 'cou ?','output','input','new line', 'break','output','Multiable_Choise')' at line 4

$connectdb = mysql_connect('localhost','root','sara', true ) or die ("Not Connect");

if (!$connectdb)

{

die('Could not connect :'. mysql_errno());

}

$selestdb = mysql_select_db('iexa', $connectdb) or die ("not selected database");

$chois_1 = array();

$chois_2 = array();

$chois_3 = array();

$chois_4 = array();

$Question = array();

$correct = array();

$correct['Correct_Answer']= mysql_real_escape_string($_POST['Correct_Answer']) ;

$Question['Question']= mysql_real_escape_string($_POST['Question']) ;

$chois_1['Choise_1']= mysql_real_escape_string($_POST['Choise_1']) ;

$chois_2['Choise_2']= mysql_real_escape_string($_POST['Choise_2']) ;

$chois_3['Choise_3'] = mysql_real_escape_string($_POST['Choise_3']) ;

$chois_4['Choise_4'] = mysql_real_escape_string($_POST['Choise_4']) ;

if (isset($_POST['E_No'])) {

$E_no = $_POST['E_No'];

}

if (isset($_REQUEST['courseID'])) {

$courseId = $_REQUEST['courseID'];

}

$sql ="INSERT INTO question_bank (C_ID ,E_No , Question , Choise_1 , Choise_2 , Choise_3 , Choise_4 , Correct_Answer

, Question_Type )

VALUES

('$courseId','$E_no', {$Question['Question']}','{$chois_1['Choise_1']}','{$chois_2['Choise_2']}','{$chois_3['Choise_3']}',

'{$chois_4['Choise_4']}','{$correct['Correct_Answer']}','$_POST[Question_Type]')

";

if (!mysql_query($sql,$connectdb))

{

die ('Error :'.mysql_error());

}

echo "The Qustion is saved";

echo '

Add Another Question

Manage Students

Home

';

mysql_close($connectdb);

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值