【发布时间】:2012-02-24 23:35:34
【问题描述】:
我有一个表格,要求用户在继续操作之前回答他们自己的安全问题。我的表格如下:
<form action="securitychecked.php" method="post">
<table width="70%" border="0">
<tr>
<td><?php $result = mysql_query("SELECT secret_question FROM public WHERE active = 'activated' AND ni = '". $_SESSION['ni']."'")
or die(mysql_error());
if (mysql_num_rows($result) == 0) {
echo '<hr><h4>This Person Has Not Setup A Security Question</h4><hr> ';
} else {
while($info = mysql_fetch_array($result))
{
echo $info['secret_question'];
}
}?></td>
<td><span id="sprytextfield1">
<input type="text" name="secret_answer" id="secret_answer" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td><br /><input name="" type="submit" value="Continue" /></td>
</tr>
</table>
</form>
我的 php 代码如下所示:
<?php
$secret_anwser=$_POST['secret_anwser'];
$secret_anwser = stripslashes($secret_anwser);
$secret_anwser = mysql_real_escape_string($secret_anwser);
$sql="SELECT secret_anwser FROM public WHERE secret_anwser ='$secret_anwser' AND active = 'activated' AND ni = '". $_SESSION['ni']."'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
if($count==1){
header("location:votenow.php");
}
?>
我有一个名为 public 的表和一个名为 'secret_anwser' 的字段,但即使输入了正确的值,我也会继续得到一个空白页。谁能帮帮我?
谢谢
【问题讨论】:
-
您在执行 sql stmt 时是否选择了正确的目录(数据库名称)?
-
是的,我确实选择了正确的数据库名称
标签: php mysql mysql-error-1064 mysql-management