Jump to content
Larry Ullman's Book Forums

Recommended Posts

I'm getting an error that says parameter 1 of mysqli_num_rows($r) should be a mysqli_result, Boolean given. Here is the applicable code:

 

$q = "SELECT email, username FROM users WHERE email='$e' OR username='$u'";

$r = mysqli_query($dbc,$q);

$rows = mysqli_num_rows($r); //This is where the error occurs.

 

Help would greatly be appreciated! Thank you.

Share this post


Link to post
Share on other sites

That means your query is failing and it's returning a Boolean--almost certainly false--instead of a result set. You should check the value of $r before trying to use it in mysqli_num_rows() and use error reporting accordingly to debug this.

Share this post


Link to post
Share on other sites

Thanks for the insight. Yes...there was an error in the code in $q, I accidently placed a single quote before username in the query which I didn't in the question I sent to you. Thanks very much.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...