当我尝试访问时 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))) { }
警告:mysql_result()[function.mysql-result]:无法跳到第11行的profile.php中MySQL结果索引5的第0行
此警告意味着$imageresultvar中没有行。签出,这应该工作:
$imageresult
$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))) { } }