警告:mysql_result() [function.mysql-result]:无法跳转到第 11 行 profile.php 中 MySQL 结果索引 5 的第 0 行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12649594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:57:58  来源:igfitidea点击:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in profile.php on line 11

phpmysql

提问by Caiapfas

When I try to access profile.php?u=destiny

当我尝试访问时 profile.php?u=destiny

//$result = mysql_query('SELECT name FROM 
$imageresult = mysql_query("SELECT name FROM imagetable WHERE id = '$id'") or die(mysql_error());
$u = mysql_result($imageresult, 0 ,"name") or die(mysql_error());
//error_reporting(E_ALL);
if (isset($id) && (!isset($u))) {
}

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in profile.php on line 11

警告:mysql_result() [function.mysql-result]:无法跳转到第 11 行 profile.php 中 MySQL 结果索引 5 的第 0 行

回答by thewebguy

This warning means that there is no row in the $imageresultvar. Check it out, this should work:

此警告意味着$imageresultvar 中没有行。检查一下,这应该有效:

$imageresult = mysql_query("SELECT name FROM imagetable WHERE id = '$id'") or die(mysql_error());
if (mysql_num_rows($imageresult) > 0) {
  $u = mysql_result($imageresult, 0 ,"name") or die(mysql_error());
  if (isset($id) && (!isset($u))) {
  }
}