【问题标题】: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 行
【发布时间】:2012-09-29 03:03:23
【问题描述】:

当我尝试访问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))) {
}

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

【问题讨论】:

标签: php mysql


【解决方案1】:

此警告意味着$imageresult var 中没有行。检查一下,这应该可以工作:

$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))) {
  }
}

【讨论】:

  • @Caiapfas 太好了!如果这是解决您问题的答案,请继续接受它:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-24
相关资源
最近更新 更多