我已经创建了一个代码,它已经正确显示但有时候当客户订购时,它会给我一个mysql错误代码,如下所示。
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 39
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 40
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 41
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 42
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 43
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 44
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 45
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/florida/public_html/vieworder.php on line 46
一旦这些代码到位,他们会删除姓名,地址,电话号码等会员信息以查看订单。我已经尝试了所有可能的选项,但我不确定我的代码是否有任何错误,我们将不胜感激。
我的代码如下:
此编码来自错误给出的行。
$queryt = "SELECT * FROM MEMBERS WHERE MID = '$CUSTOMER' ";
$resultt = mysql_query($queryt) or die('Query failed: ' . mysql_error());
$numt=mysql_numrows($resultt);
$FIRSTNAME=mysql_result($resultt,$it,"FIRSTNAME");
$LASTNAME=mysql_result($resultt,$it,"LASTNAME");
$EMAIL=mysql_result($resultt,$it,"EMAIL");
$PHONE=mysql_result($resultt,$it,"PHONE");
$ADDRESS1=mysql_result($resultt,$it,"ADDRESS1");
$ADDRESS2=mysql_result($resultt,$it,"ADDRESS2");
$CITY=mysql_result($resultt,$it,"CITY");
$STATE=mysql_result($resultt,$it,"STATE");
?>
<? echo $FIRSTNAME?><br />
<? echo $LASTNAME?><br />
<? echo $EMAIL?><br />
<? echo $PHONE?><br />
<? echo $ADDRESS1?><br />
<? echo $ADDRESS2?><br />
<? echo $CITY?><br />
<? echo $STATE?><br />
<br />
<br />
同样错误并不是每个人都会发生的,很多会员可以在没有任何错误问题的情况下订购,但是有些会随机出现问题所以不是同一个人。
答案 0 :(得分:0)
您的查询是否返回了任何结果?
$numt=mysql_numrows($resultt);
if ($numt > 0) {
echo "rows found";
} else {
echo "none found";
}
看起来您正在尝试在空结果集中查找值。在尝试使用结果数据之前,您需要验证是否确实得到了结果。
答案 1 :(得分:0)
除了代码中的许多问题之外,这可能是因为您在查询成功执行时跳过了这种情况,但返回0行。添加该检查,你应该没事。
以下是代码的其他潜在问题:
mysql_*
功能(使用mysqli_*
或PDO
)short_tags
指令mysql_query(/**/) or die();
- 可向用户显示错误消息(安全漏洞)