stickcult Posted August 24, 2008 Share Posted August 24, 2008 Hello, I'm new here (just signed up to post this), but I have an error that I can't figure out, and is really bothering me.. The code causing the error is $query = "SELECT * FROM quizsite_login WHERE username={$user} and password={$pass}"; $result = mysqli_query($link,$query); $numrows = mysqli_num_rows($result); and the error is Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in ........ on line 20 Any help at all would be appreciated! Link to comment https://forums.phpfreaks.com/topic/121106-error-with-mysqli_num_rows/ Share on other sites More sharing options...
DarkWater Posted August 24, 2008 Share Posted August 24, 2008 Your query failed. You need to check if the query failed with something like: $result = mysqli_query($link, $query) OR die(mysqli_error($link)); By the way, your query failed because you had no ' ' around your username or password in the query, making MySQL think it was a column name and not a string. Link to comment https://forums.phpfreaks.com/topic/121106-error-with-mysqli_num_rows/#findComment-624332 Share on other sites More sharing options...
stickcult Posted August 24, 2008 Author Share Posted August 24, 2008 Thank you! Seems obvious now... Link to comment https://forums.phpfreaks.com/topic/121106-error-with-mysqli_num_rows/#findComment-624334 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.