Syntax of SQL query in PHP code
Sorry, this is probably something that falls between PHP and mySQL, so apologies if this is in the wrong section.
I am using a bit of code that autocompletes a field when someone types:
$rs = mysql_query('select Lodge from lodges Lodge like "%'. mysql_real_escape_string($_REQUEST['term']) .'%" order by Lodge asc limit 0,50', $dblink);
Which works great, and looks up all the records in the table lodges.
But I'd like it to filter on a particular field, and can't get it to work - basically just need to add something like the following to filter out records where a particular field is not blank:
select Lodge from lodges WHERE field name <> '' AND lodges like....
This must be an easy one, but I can't seem to get the syntax.