PHP Login: expects parameter 1 to be resource, boolean given
Posted: Mon Nov 28, 2011 11:59 am
Hi
I too am having the same problem. Records are being entered into the database, but I get the error:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in /home/########/public_html/core/inc/user.inc.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home//########//public_html/core/inc/user.inc.php:7) in /home//########//public_html/register.php on line 33
The user.inc.php code is:
Thanks for your time and help.
Shaun
I too am having the same problem. Records are being entered into the database, but I get the error:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in /home/########/public_html/core/inc/user.inc.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home//########//public_html/core/inc/user.inc.php:7) in /home//########//public_html/register.php on line 33
The user.inc.php code is:
<?php function user_exists($user) { $user = mysql_real_escape_string($user); $total = mysql_query("SELECT_COUNT(`user_id`) FROM `########_users` WHERE `user_name` = '{$user}'"); return (mysql_result($total, 0) === '1') ? true : false; } function valid_credentials($user, $pass) { $user = mysql_real_escape_string($user); $pass = sha1($pass); $total = mysql_query("SELECT_COUNT(`user_id`) FROM `########_users` WHERE `user_name` = '{$user}' AND `user_password` = '{$pass}'"); return (mysql_result($total, 0)== '1') ? true : false; } function add_user($user, $pass) { $user = mysql_real_escape_string(htmlentities($user)); $pass = sha1($pass); mysql_query("INSERT INTO `########_users` (`user_name`, `user_password`) VALUES ('{$user}', '{$pass}')"); } ?>Is there something obvious I've missed here?
Thanks for your time and help.
Shaun