Hi,
I am having trouble with getting rows from a MySQL table using the like statement.
I have a table which contains information relating to 5 cities.
eg.
table_name
City COLUMN_2 COLUMN_3
Bali ... ...
Vegas ... ...
my sql query is currently:
"SELECT column_2, column_3 from table_name WHERE CITY LIKE '%".$CITY."%' ";
where $city is the input from the radio button. At the moment if the user selects just 1 city it works fine and if they select anymore than 1 it doesnt work because there is no row that contains both bali and vegas ect.
is there any way around this, so that they can select multiple cities and it will show the rows that contain the chosen cities?
Thanks very much.
matt.
I am having trouble with getting rows from a MySQL table using the like statement.
I have a table which contains information relating to 5 cities.
eg.
table_name
City COLUMN_2 COLUMN_3
Bali ... ...
Vegas ... ...
my sql query is currently:
"SELECT column_2, column_3 from table_name WHERE CITY LIKE '%".$CITY."%' ";
where $city is the input from the radio button. At the moment if the user selects just 1 city it works fine and if they select anymore than 1 it doesnt work because there is no row that contains both bali and vegas ect.
is there any way around this, so that they can select multiple cities and it will show the rows that contain the chosen cities?
Thanks very much.
matt.
Comment