How to get Joomla users data into a json array
Posted
by
sami
on Stack Overflow
See other posts from Stack Overflow
or by sami
Published on 2012-12-10T16:54:28Z
Indexed on
2012/12/10
17:03 UTC
Read the original article
Hit count: 265
$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 ?
© Stack Overflow or respective owner