Parašė rokasbalsys· 2014 Kov. 27 22:03:39
#1
Sveiki, taigi meta errora, jau kelinta karta tikrinu koda bet nerandu problemos, tai prasausi pagalbos is patyrusiu:
Erroras kuri meta:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\IR\core\functions\users.php on line 23
mano
php kodas
<?php
function user_exists($username) {
$username = sanitize($username);
return (mysql_result(mysql_query("SELECT COUNT(`USER_id`) FROM `users` WHERE `username`='$username'"), 0) == 1) ? true : false;
}
function user_active($username) {
$username = sanitize($username);
return (mysql_result(mysql_query("SELECT COUNT(`USER_id`) FROM `users` WHERE `username`='$username' AND `active` = 1"), 0) == 1) ? true : false;
}
function user_id_from_username($username) {
$username = sanitize($username);
return mysql_result(mysql_query("SELECT `USER_id` FROM `users` WHERE `username`='$username'"), 0, 'USER_id');
}
function login($username, $password) {
$USER_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);
return (mysql_result(mysql_query("SELECT COUNT (`USER_id`) FROM `users` WHERE `username`='$username' AND `password`='$password'"), 0) == 1) ? $USER_id : false;
}
?>
kur cia problema ? Dar tureciau klausyma kaip cia i foruma parasyti koda kad rodytu eilutes nr kaireje, butu jum lengviau
Redagavo rokasbalsys· 2014 Kov. 27 22:03:49