Hi, i am getting this error for an email activation function. can someone help me removing this error message and make it work?
Error:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in /home/prevpxmj/public_html/core/functions/users.php on line 6
Code:
<?php
function activate($email, $email_code){
$email = mysql_real_escape_string($email);
$email_code = mysql_real_escape_string($email_code);
if (mysql_result(mysql_query("SELECT COUNT (`user_id`) FROM `users` WHERE `email` = '$email' AND `email_code` = '$email_code' AND `active` = 0"), 0)==1) {
// query to upadate user activa status
mysql_query("UPDATE `users` SET `activate` = 1 WHERE `email` = '$email'");
return true;
} else {
return false;
}
}
?>