UNION parse error (and dynamic UNION)
Hi All,
I'm having trouble with a UNION.
Here is my code:
PHP Code:
$result = mysqli_query($link, 'SELECT * FROM table_1 WHERE MATCH(column) AGAINST('$keyword1*' IN BOOLEAN MODE)
UNION
SELECT * FROM table_2 WHERE MATCH(column) AGAINST('keyword2*' IN BOOLEAN MODE)';
I keep getting a parse error - but can't figure out what it is. Any ideas?
As a second question - is it possible to build a dynamic UNION query? I think this would be optimal but I'm not sure that this is possible.
I ask because I will need to add one more AND clause to the query above from a set of checkboxes the user can submit with this form.
Thanks in advance - hope it is clear.