Avatar of MOSTAGHASSI
MOSTAGHASSI
Flag 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
PHP

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
Ray Paseur

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

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
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MOSTAGHASSI

ASKER
Thanks,sometimes there are simple solution that we don't think.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Ray Paseur

Thanks for the points, and thanks for using E-E! ~Ray