可能重复:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
我清除了数据库后发生了这个错误...我怎么会正确地重写它。现在编码假定总会有数据是真的但是因为我从头开始我想确保它写得正确。
警告:mysql_num_rows():提供的参数不是第46行/includes/dologin.php中的有效MySQL结果资源
//store remember-me cookie
if ($remember && @mysql_num_rows($result) == 0) {
setcookie('remember','',time()-360000,constant('dir'));
}
//require image for login?
if (require_image_login == 'Yes') {
$c = @mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt
FROM $picstable WHERE i_status=2 AND i_user='$line[m_id]'"));
$images = $c['cnt'];
} else {
$images = 1;
}
if (mysql_num_rows($result) == 0) { // <----- this is line 46
//unsuccessful login
$en['login_message'] = '<strong>Login Failed!</strong> - Your Member name and/or Password was entered incorrectly.';
if (isset($_COOKIE['remember'])) {
setcookie('remember','',time() - 360000,constant('dir'));
}
load_template(tpl_path.'login.tpl');
}
答案 0 :(得分:1)
你的代码中没有$result
,你可能意味着
if ($images == 0) { // <----- this is line 46