[Solved] How to get Joomla users data into a json array [closed]


You are overwriting the $id variable and then you are not using it…

It seems there’s a mess in there with the $title, $name and $id variables.

Try this:

 <?php 
$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'];  //change here
$name=$row['name']; //change here

//change variables here
$posts[] = array('id'=> $id, 'name'=> $name);

} 

$response['jos_users'] = $posts;

$fp = fopen('results.json', 'w');
fwrite($fp, json_encode($response));
fclose($fp);


?> 

3

solved How to get Joomla users data into a json array [closed]