I get a string from java: "2011-11-25 08:16:50" post_date column is TIMESTAMP But the following query gives no results. What is the error?
$date2 = $_POST['Date'];
$result= mysql_query("Select * FROM (Select * FROM user WHERE latitude > $minLat AND latitude < $maxLat AND longitude > $minLon AND longitude < $maxLon AND post_date > $date2 ORDER BY post_date DESC LIMIT $amount1) a ORDER BY post_id");
while($results = mysql_fetch_assoc($result))
$output[]=$results;
print(json_encode($output));
mysql_close();
mysql_query()call. Otherwise, your script will break if the query fails. How to do this is outlined in the manual onmysql_query()or in this reference question.mysql_real_escape_string()for the classic mysql library), or switch to PDO and prepared statements.