Warning: mysql_result () [function.mysql-result]: it is not possible to go to line 0 at the MySQL 5 result index in the profile.php file on line 11

When I try to access 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]: it is not possible to go to line 0 at the MySQL 5 result index in the profile.php file on line 11

+1
source share
1 answer

This warning means that $imageresultvar does not have a string. Check this out, this should work:

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

Source: https://habr.com/ru/post/1606760/


All Articles