Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Exclusion Help

Status
Not open for further replies.

digatle

Technical User
Oct 31, 2003
85
US
I need to modify my SQL query (seen below) to exclude result. What I need to exclude is:

WHERE `category_id`=\"90".$dept."\"

How do I add a statement to exclude this information?

$menubardep = mysql_query( "SELECT `category_id`, `url`, `description` FROM `spidernet_menubar` WHERE `category_id`=".$blog_id." " );

Digatle
 
If I understood correctly...

$menubardep = mysql_query( "SELECT `category_id`, `url`, `description` FROM `spidernet_menubar` WHERE (`category_id`=$blog_id AND `category_id`!="90$dept");

is this what you meant???
pay attention that php can replace vars inside strings... :)


 
Just add that condition to the select.
Code:
$menubardep = mysql_query( &quot;SELECT `category_id`, `url`, `description` FROM `spidernet_menubar` WHERE `category_id`=&quot;.$blog_id.&quot;  AND category_id<>'90&quot;.$dept.&quot;'&quot; );

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top