在我插入 where 语句之前,我的错误给出了 1064 它工作。我把 where 放在 from 之前还是之后?
<?PHP
session_start();
include ("connection.php");
$city = $_POST['city'];
$state = $_POST['state'];
$results = array();
if( $query = $db->query("SELECT business_id, BusinessName, date, post ".
"FROM WolfeboroC.posts ". "WHERE city= '$city' && state='$state'".
"JOIN WolfeboroC.users ON users.recid = posts.business_id ".
"ORDER BY date DESC LIMIT 0, 500") )
{
while($record = $query->fetch_assoc())
{
$results[] = $record;
}
$query->close();
}
echo json_encode($results);
?>