I seem to be having problems with my code and can't trace the issue. I want to have a search for multiple columns in my db, but I'm getting an error report.
I altered the table like so
"ALTER TABLE products ADD FULLTEXT alltext (`title`, `cat`, `status`, `description`, `tags`)";
And also changed the default engine to MyISAM
But when I run this query by searching through my search box I get an error.
$sql="SELECT * FROM products as p INNER JOIN amenities as a ON p.product_id=a.product_id WHERE MATCH(p.title,p.cat,p.status,p.description,p.tags) AGAINST ('$search' )";
mysqli_query($con,$sql);
And other conditions follows....
Which should give me results if my search word is in any of the rows.. But it returns a bad query error. Also tried adding an IN BOOLEAN just after the '$search'... i.e
$sql="SELECT * FROM products as p INNER JOIN amenities as a ON p.product_id=a.product_id WHERE MATCH(p.title,p.cat,p.status,p.description,p.tags) AGAINST ('$search' IN BOOLEAN)";
Which gives no results when there are obviously matching terms in the table rows.
This is my search variable
$search = mysqli_real_escape_string($con, $_POST['q']);
Any help on this will be appreciated.