Help with MySQL Select statement in PHP code
Posted: Sun Feb 03, 2008 3:22 pm
I've got the following SQL statement that I'm wanting to customize for a website I'm working on.
$query="SELECT * FROM #__alberghi_facilities WHERE id IN (".$item->facilities.")";
Basically, I'm wanting to not include certain id's in the query.
For example, lets say that $item->facilities included 3, 5, 8, 9 and I wanted to exclude 8 from the query.
I want the select to pull the records except 5 and 9. I know that an and statement is needed but I'm not sure how to do it.
Any help would be appreciated.
$query="SELECT * FROM #__alberghi_facilities WHERE id IN (".$item->facilities.")";
Basically, I'm wanting to not include certain id's in the query.
For example, lets say that $item->facilities included 3, 5, 8, 9 and I wanted to exclude 8 from the query.
I want the select to pull the records except 5 and 9. I know that an and statement is needed but I'm not sure how to do it.
Any help would be appreciated.