这里是写的代码是RadarsMySql.php
<?php
$con = mysql_connect("localhost","root","dacian");
$db = mysql_select_db("radars");
$sql = mysql_query("SELECT latitude,longitude,description FROM radars WHERE id > '0'");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
print(json_encode($output));
foreach($out["radars"] as $radars) {
$latitude = addslashes($radars[latitude]);
$longitude= addslashes($radars[longitude]);
$description = addslashes($radars[description]);
mysql_query("INSERT INTO radars (latitude, longitude, description) VALUES('$name', '$ingredients', '$ingredients2')") or die (mysql_error());
}
mysql_close(); ?>
它给了我这个错误:
Notice: Undefined variable: out in C:\xampp\htdocs\RadarsMySql.php on line 13
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\RadarsMySql.php on line 13
我需要这个,因为我想使用 JSON 从 android 应用程序写入数据。谁能告诉我出了什么问题或给我一些提示?