我使用$sql = mysql_query("SELECT * FROM upload WHERE country='singapore' ");
while ($row = mysql_fetch_array($sql))
{
$country = $row['country'];
$lat = $row['lat'];
$long = $row['long'];
$array = array($country ,$lat, $long);
foreach ($array as $value)
{
$array[] = $value;
}
$value = '[{"id":"36","latitude":"'.$array[1].'","longitude":"'.$array[2].'","username":"User Name 1","country":"Srbija","city":"'.$array[3].'","cityPart":"Grbavica","street":"","price":"200","area":"40","images":"img\/testimg.png[split]img\/testimg.png[split]img\/testimg.png","furniture":"Yes"}]'."<br>"."<br>";
}
$db = json_decode($value, true);
for( $i = 0; $i < sizeof($db); $i++)
{
print_r ($data = $db[$i]);
}
,但我认为应该存在更好的方法。
谢谢你的帮助!