I’m very inexperienced in SQL and am trying to setup a search for a site (the input is posted from a form) based on several template variables (ie retrieve all the page id’s where $town = ’new york’ and $location = ’city’).
It must be dead obvious, but I can’t figure out how to setup an AND query for multiple fields in the ’value’ column.
It works for ’$town’ OR ’$location’, but not ’$town’ AND ’$location’. This is what I have -
$sql="SELECT DISTINCT contentid FROM vs5090_1_site_tmplvar_contentvalues WHERE (value=’" . $town . "’) AND (value=’" . $location . "’)";
Can anyone point me in the right direction?
-
☆ A M B ☆
- 24,524 Posts
Unless this is a "settings" kind of table, with a column "name" and a column "value", like the MODx system_settings table.
-
☆ A M B ☆
- 24,524 Posts
I knew that!