I have 3 individual FULLTEXT indexes on columns: City, Text, Group and 3 corresponding values $city, $text and $group.
What I want to do is basically have multiple WHERE conditions that only run if the variable is defined. E.G if $city and $text are defined a WHERE for $city in column City and a WHERE for $text in column Text.
This is my current MySQL query:
$result = mysql_query("
SELECT * FROM Posts
WHERE MATCH (City) AGAINST ('$city')
ORDER by Date DESC LIMIT $limit_posts OFFSET $first_post
");
I don't know how to do it without messing the query.
How can I do it?