How to get Joomla users data into a json array
- by sami
$sql = "SELECT * FROM `jos_users` LIMIT 0, 30 ";
$response = array();
$posts = array();
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
$id=$row['id'];
$id=$row['name'];
$posts[] = array('id'=> $title, 'name'=> $name);
}
$response['jos_users'] = $posts;
$fp = fopen('results.json', 'w');
fwrite($fp, json_encode($response));
fclose($fp);
I want to fetch the user id and name to the json file.i thought id did wrong code.can anyone correct it ?