Okay, so I would like to say in advance, thank you for the help. With that said, I am having an extraordinary amount of trouble with some code. So here it is:
function school_user_exists($school_user = false, $school_id = false) {
if($school_user || $school_id) {
$school_user = sanitize($school_user);
$school_id = (int)$school_id;
$query = mysql_query("SELECT COUNT(`logs_id`) FROM `school_logs` WHERE `school_user` = '$school_user' AND `school_id` = '$school_id'");
return (mysql_result($query, 0) == 1) ? true : false;
} else {
echo 'Something is amiss!';
}
}
function logs_id_from_schooluser($school_user = false, $school_id = false) {
if ($school_user || $school_id) {
$school_user = sanitize($school_user);
$school_id = (int)$school_id;
return (mysql_result(mysql_query("SELECT `logs_id` FROM `school_logs` WHERE `school_user` = '$school_user' AND `school_id` = '$school_id'"),0, 'logs_id'));
} else {
echo 'There seems to be a parameter missing!';
}
}
The logs_id_from_schooluser is giving the error:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 14 in /Users/Home/Sites/functions/users.php on line 6
As you can see I posted the functions in the manner that Im attempting to debug with. The tables do in fact have the information that is required as I put multiple mock accounts in to test them. Ideally, this should be returning the logs_id in order to update other fields in a separate account.