Computing.Net > Forums > Programming > mysql skip error

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

mysql skip error

Reply to Message Icon

Name: Ken
Date: October 8, 2003 at 14:45:43 Pacific
OS: xp
CPU/Ram: 2.4
Comment:

Can anyone please tell me what mysql returns if no records are found?
Here is what I am doing:
$query = "select from ....";
$result = mysql_query($query);
if (!$result) :
print "Could not find data!";
endif;
if($result){ blah blah...}

It seems to skip my error message. Any ideas?
Thanks in advance,
Ken



Sponsored Link
Ads by Google

Response Number 1
Name: Barrett
Date: October 17, 2003 at 10:27:39 Pacific
Reply:

Looks like you're coding in PHP, right? Admittedly I'm a PHP newbie myself but...

According to the users manual (http://us2.php.net/manual/en/function.mysql-query.php), mysql_query only returns False if the query fails. So if your query is runnable, $result will have a return value even if there are no results.

Instead of if(!$result), try using if(!mysql_fetch_row($result)) That should evaluate to true if there are no result rows.


0
Reply to Message Icon

Related Posts

See More


VBA to VB... VB Read an array from an...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: mysql skip error

mySql 1044 error www.computing.net/answers/programming/mysql-1044-error/10811.html

PHP and MYSQL, query wont work www.computing.net/answers/programming/php-and-mysql-query-wont-work/10069.html

MySQL ERROR 2003 www.computing.net/answers/programming/mysql-error-2003/12134.html