我希望有人可以帮助我,我有一个错误
警告:mysql_fetch_assoc() 期望参数 1 是资源,布尔值在第 17 行的 C:\xampp\htdocs\phpacd\func\user.func.php 中给出
它所指的线是$query_reult = mysql_fetch_assoc($query)
。代码来自教程,我一遍又一遍地阅读教程,我无法发现问题!如果有人能指出我正确的方向,我会喜欢吗?
function login_check($email, $password) {
$email = mysql_real_escape_string($email);
$login_query = mysql_query("SELECT COUNT(`user_id`) as `count`, `user_id` FROM `users` WHERE `email`='$email' AND `password`='".md5($password)." '");
return (mysql_result($login_query, 0) == 1) ? mysql_result($login_query, 0, 'user_id') : false;
}
function user_data() {
$args = func_get_args();
$fields = '`'.implode('`, `' , $args).'`';
$query = mysql_query("SELECT $fields FROM `users` WHERE `user_id` =".$_SESSION['user_id']);
$query_result = mysql_fetch_assoc($query);
foreach ($args as $field){
$args[$field] = $query_result[$field];
}
return $args;
}