I've searched this issue high and low. I've also seen it asked in many places but never to the point in which i am having the issue. Nor I have found a solution that has fixed mine. I've spent a very long time trying to fix this and I can not move forward until it has been resolved any help would be GREATLY appreciated.
It's a login & register tutorial by phpacademy.
My error is as follows:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\lr\core\functions\users.php on line 5
The code I have for my users.php file is as follows and is 100% the same as is on the tutorial. Mine fails to work his does not.
<?php
function user_exists ($username) {
$username = sanitize($username);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username'");
return (mysql_result($query, 0) == 1) ? true : false;
}
?>
The following is line 5 from the above code where the error appears to be resulting from.
return (mysql_result($query, 0) == 1) ? true : false;
Thanks again in advance.