View Single Post
Old 12-07-2007, 05:32 AM   #1 (permalink)
CoryMathews
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default php within a query

I couldnt seem to figure this out on my own and google was not being my friend on this one.

Im trying to do a normal MySQL query but with a php if inside it. sounds simple enough ive done it in coldfusion multiple times just cant get the syntax for it in php. Example

PHP Code:
$result mysql_query(
select * 
from 
$dbName 
//Next Line 
Where if(isset(
$cat) { $cat = '1' } 
order by updated DESC, time DESC 
LIMIT 
$from$max_results"); 
That Where clause is my problem. but i think i got the point across of what im needing.
CoryMathews is offline  
Reply With Quote