Checking for blank queries

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
AlbinoJellyfish
Forum Commoner
Posts: 76
Joined: Sun Apr 04, 2004 7:39 pm

Checking for blank queries

Post by AlbinoJellyfish »

Quick question

How do I check the results of a query to see if it returned no results?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

couple ways:

Code: Select all

if(!$row = mysql_fetch_assoc($result))
//
$numrows = mysql_num_rows($result)
Post Reply