OK. If I change the test to "if(mysql_num_rows($thisRow) < 1)" it does what I want. I guess if I want to understand why False was returned originally (just after I created the database) I need to start over. Do I have 4 possible conditions here: 1) the mysql_query() function fails and I get a PHP error, 2) the query fails at the server and I get False, or 3) the query doesn't fail at the server and I get "a result" that a) is empty, or b) contains 1 or more rows? Yes. Problem solved (my code was naive), understanding increased (my code won't be naive in the future as regards mysql functions in PHP). Thank you very much.. "Chris" <dmagick@xxxxxxxxx> wrote in message news:4AAD74E5.3090505@xxxxxxxxxxxx > Stan wrote: > > I did a "DELETE FROM picture" where "picture" is a table in my database. > > Because this deletes all your records - so doing a select afterwards > will find nothing. > > > Afterward, this piece of code does not generate an error > > ---------------------------------------------- > > try > > { > > $query = "SELECT * FROM picture p " . > > "WHERE p.pictureFile='" . $pictureFile . "'"; > > $thisRow = > > mysql_query($query, $pictures_connection); > > } > > catch(Exception $e) > > { > > echo 'caught exception: ', $e->getMessage()."\n"; > > $result = False; > > } > > an empty result set is fine - it means no records found. It will not > generate an exception. > > I'm not sure when mysql will generate an exception either, mysql_query > returns FALSE if the query fails (see http://www.php.net/mysql_query). > You then have to use mysql_error to get the reason why it failed. > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php