Where the code is wrong its giving me an error on mysql_assoc;
if($_SERVER['REQUEST_METHOD'] == "POST"){
$sql=mysql_query("SELECT * FROM users");
$query = mysql_query($sql);
$json = array(); // create empty array
$i = 0; // start a counter
while($result=mysql_fetch_assoc($query)){
$json[$i]['name'] = $result['name'];
$json[$i]['email'] = $result['email'];
$i++;
}
if(count($json)>0){
}else{
$json = array( "msg" => "No infomations Found");
}
header('Content-type: application/json');
}
this an error after running the service;
<br />
<b>Warning</b>: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\satyam\services\select.php</b> on line <b>11</b><br />