What value does $query = mysql_query("select * from member where loginID like '$loginID'") return if there is no field with loginID = $loginID

I have the following code...
$query = mysql_query("select * from member where loginID like '$loginID'");

I have an if statement that follows as thus...
if(!empty($query)){
//code
}

that if statement, though, won't execute if there is a value in $query
jabrthelAsked:
Who is Participating?
 
hieloConnect With a Mentor Commented:
it returns a resource which has zero records. So if you are trying to find out how many records were returned you need:
$query = mysql_query("select * from member where loginID like '$loginID'");
if( 0==mysql_num_rows($query) )
{
  echo "No records found";
}
0
 
jabrthelAuthor Commented:
That worked, I just needed to change == to !=
0
 
jabrthelAuthor Commented:
thanks
0
 
hieloCommented:
You are welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.