View Single Post
Old 12-07-2007, 02:36 PM   #4 (permalink)
Karl
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Can't you just test for the existence of $cat outside the query and then insert data if you have any...

PHP Code:
$szCatQuery = isset($cat) ? "WHERE $cat = 1" '';

$result mysql_query(
select * 
from 
$dbName 
//Next Line 
$szCatQuery
order by updated DESC, time DESC 
LIMIT 
$from$max_results"); 
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote