Writing in database via JSON php issue

rehan

New Member
Here is the code is written is RadarsMySql.php\[code\] <?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(); ?>\[/code\]It gives me this error : \[code\]Notice: Undefined variable: out in C:\xampp\htdocs\RadarsMySql.php on line 13Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\RadarsMySql.php on line 13\[/code\]I need this because i want to write data from android app using JSON. Could anyone tell me what is wrong or to give me some tips ?
 
Back
Top