How to convert MYSQL query result into JSON?
Convert MYSQL query result into JSON
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
<?php
include "db.php";
$uid=$_REQUEST['uid'];
$data=array();
$sql=mysql_query("select * from tableName where user_id='$uid'");
while ($row=mysql_fetch_object($sql)){
$data[]=$row;
}
if(!empty($data)){
echo json_encode($data);
}else{
echo json_encode(false);
}
?>