Link to home
Start Free TrialLog in
Avatar of MOSTAGHASSI
MOSTAGHASSIFlag for United States of America

asked on

Correction php query

Hello;

I have a query as bellow:

		 $query_suggested_artandculturecat_article = "select tbarticles.title,tbarticles.deletitem,tbarticles.articleid,tbcategories.parentid,tbcategories.catid,tbarticlecategories.catname,tbphotos.photofilename,tbarticlecategories.catid
	 
from  tbarticles 
INNER JOIN tbphotos on tbphotos.articleid = tbarticles.articleid 
INNER JOIN tbarticlecategories on tbarticlecategories.articleid =  tbarticles.articleid
INNER JOIN tbcategories ON tbcategories.catid = tbarticlecategories.catid 


where tbarticles.deletitem='1'  AND tbcategories.catid ='$urlcomecatid'
ORDER BY  RAND()
LIMIT 9

Open in new window


and i want correct as :
if($urlcomecatid=166 OR 62)
 $urlcomecatid=175;

Open in new window

please let me know how can correct the query?

Thanks
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Add these instructions before the query.  As other values need to be changed, just follow a similar pattern.
if($urlcomecatid == 166) $urlcomecatid=175;
if($urlcomecatid ==  62) $urlcomecatid=175;

Open in new window

Avatar of MOSTAGHASSI

ASKER

But i did it before and have problem,because after this query i have another query and with  these 'if condition' the  $urlcomecatid remain 175 while i want that only in this query(that i posted its codes) it be  175 for those conditions.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks,sometimes there are simple solution that we don't think.
Thanks for the points, and thanks for using E-E! ~Ray