Cheers for helping me out guys.
It proved to fiddly and kludge-like to do what I wanted in SQL (I'll
wait until MySQL 4 stable version is about)
So I did some stuff with PHP arrays which worked fine.
Thanks a lot anyway.

-----Original Message-----
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 4:13 PM
To: Russ
Subject: Re: [PHP-DB] SQL guru needed!

Is TourCatID a table? you can't do that, this is a subquery
Build first a string $string with all the values of TourCatID in it such
as ('a', 'b', ...)
And replace your query by IN $string
Also quotes needed around $_GET[CatID] 

----- Original Message ----- 
From: Russ <mailto:[EMAIL PROTECTED]>  
Sent: Tuesday, August 20, 2002 9:59 AM
Subject: [PHP-DB] SQL guru needed!

Hiya folks:

I wish to be able to select items from MySQL if a variable passed via
the $_GET method to my PHP4 page is introduced thus:

$sql = "SELECT TourName,TourID,$_GET[CatID] IN (TourCatID) FROM tour";

When I echo $sql to the page, the query looks fine but doesn't work, in
as far as the wrong results are returned. MySQL doesn't throw up an
error either.
I'm using MySQL 3.23.49-nt-log. Can anyone enlighten me please ?? 

Mr Russ Michell
Web Applications Developer 
Tel: +61 (0)8 9321 3844 
Fax: +61 (0)8 6210 1364 
Post: PO Box 228, Innaloo, WA 6918, Australia 
Street: Suite 24, 158 William St, Perth, WA 6000, Australia

"No proof of existence is not proof of non-existence."
(Physicist: Stanton T. Friedman on Debunking Ufology)

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to