【发布时间】:2011-02-24 19:53:41
【问题描述】:
我有一个简单的mysql_query() update 命令来更新mysql。
当用户提交我的表单时,它会跳转到一个更新页面来更新数据。问题是更新后应该显示一些数据,但它显示为空白。
我的表格
<form id="form1" method="POST" action="scheduleUpdate.php" >
<select name=std1>
<option>AA</option>
<option>BB</option>
<option>CC</option>
</select>
<select name=std2>
<option>DD</option>
<option>EE</option>
<option>FF</option>
</select>
.......//more drop down menu but the name is std3..std4..etc...
.......
</form>
scheduleUpdate.php
//$i is the value posted from my main app to tell me how many std we have
for($k=0;$k<$i;$k++){
$std=$_POST['std'.$k];
//if i remove the updateQuery, the html will output.I know the query is the problem but i //couldn't fix it..
$updateQuery=mysql_query("UPDATE board SET
student='$std'
WHERE badStudent='$std' or goodStudent='$std'",$connection);
//no output below this line at all
if($updateQuery){
DIE('mysql Error:'+mysql_error());
}
}
// I have bunch of HTML here....but no output at all!!!!
点击提交后MySQL会更新,但没有显示任何HTML。
【问题讨论】:
-
NVM。我现在修复它...我的 if($updateQuery) 应该是 if(!updateQuery)........不敢相信这个小感叹号可能意味着很多!......
-
@Jerry 您可以将此作为答案发布并接受它,或者删除问题(链接就在这些 cmets 上方,在标签列表下)。编辑:或者接受最近提交的一个说同样事情的答案
-
然后要么将其作为答案并接受它,要么删除此问题
-
哇..你们真快。由于 jeroen 是第一人称回复。你得到了我接受的答案!并向所有人 +1