I have a complex query and it was working fine before adding one more line: the working query:
$query = "SELECT SQL_CALC_FOUND_ROWS *
FROM realestate
INNER JOIN users ON id_user = users.id
LEFT JOIN pic ON id_realestate = realestate.id
group by realestate.id
ORDER BY {$order}
LIMIT 0 , 10";
the value of $order is date DESC
after adding one more line, here is the query:
$query = "SELECT SQL_CALC_FOUND_ROWS *
FROM realestate
{$place}
INNER JOIN users ON id_user = users.id
LEFT JOIN pic ON id_realestate = realestate.id
group by realestate.id
ORDER BY {$order}
LIMIT 0 , 10";
$place has this value WHERE address =1 the field name address doesn't duplicate in other tables.
I get this mysql error :
Database query failed: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near
'INNER JOIN users ON id_user = users.id LEFT JOIN pic ON id_realestate = real'
at line 4