Why not search on if it's there, if no results are returned, you know it's not there.
SELECT count(*) as langcount from db where lang=$lang;


If you want to check for multiple items at once:
SELECT count(*) as langcount from db where lang in ('lang1', 'lang2', ...)


Since you don't want to actually return the records that don't match a criteria, you don't need to do a not equals search.

On May 28, 2004, at 9:21 AM, LR Sieting wrote:

Hello,

I have several tables that have a common column. I need to check those tables for 1 of 4 items. If that item does not exist, I jump to a page saying it is coming soon...

I am passing a variable ($lang) around using php to select info based on that column.

what would be a suggested select statement be?

The database is small enough that I can search each table individually.

select lang from menus where lang <>  $lang ?????

This is one of the tables.... trimmed as needed...
CREATE TABLE `menus` (
 `id` int(5) NOT NULL auto_increment,
 `lang` enum('Eng','Fre','Deu','Esp') NOT NULL default 'Eng',
 `home` char(32) NOT NULL default '',
 `products` char(32) NOT NULL default '',
 `tech` char(32) NOT NULL default '',
 `sales` char(32) NOT NULL default '',
 PRIMARY KEY  (`id`),
 KEY `language` (`lang`)
) TYPE=MyISAM;



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to