php - select count 3 tables -
this question has answer here:
i trying query 3 tables returning error. want code check 3 tables whether user registered in 1 of these tables if tries log in. please me i'm php beginner.
i following error:
warning: mysql_result() expects parameter 1 resource, boolean given in
this code:
//check user if exist function user_exists($username){ $username = sanitize($username); return (mysql_result(mysql_query("select count(`user_id`) `users`,`admin`,`guest` `username` = '$username'"), 0) == 1) ? true : false;
it appears attempting grab 3 different tables using single select
, cannot work.
i'd suggest trying use join
, if unfamiliar (and in worst case), using 3 separate select
queries achieve end goal.
Comments
Post a Comment