can anybody help me please? i tried to use mysql_fetch_array but it returned this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
I would like to know how i could determine whether the result of my query is empty or not. It's like determining if a certain username and password exists in the database or not. Thanks a lot people.
How to determine an empty query?
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You need to add some error handling to your mysql_query() call because it appears as if your query might be failing. Don't have your code so I can only offer an example:
Using mysql_error() should give you a more useful, MySQL generated error which should help you find out what is wrong with the SQL statement.
Mac
Code: Select all
$sql = "SELECT field1, field2 FROM table WHERE field1='$somevariable' AND field2='$someothervariable'";
@$result = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');Mac