Jump to content

MySQL Select from (no column)


maxudaskin

Recommended Posts

Maybe this is what your looking for:

 

mysql_query("select * from flights WHERE 
colum1 LIKE '{$searchfield}'
AND colum2 LIKE '{$searchfield}'
AND colum3 LIKE '{$searchfield}'
AND colum4 LIKE '{$searchfield}'");

 

So...

mysql_query("select * from flights WHERE 
colum1 LIKE '{$searchfield}', colum2 LIKE '{$searchfield}', colum3 LIKE '{$searchfield}', colum4 LIKE '{$searchfield}'")

?

 

You'd want OR and not AND if you want ro search for the value in any column. If you use AND, it has to be in EVERY column

 

$result = mysql_query("select * from flights WHERE 
          (column1 LIKE '%$searchfield%')
           OR (column2 LIKE '%$searchfield%')
           OR (column3 LIKE '%$searchfield%')
           OR (column4 LIKE '%$searchfield%') ");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.