how to return multiple array items using json/jquery
<p>Hey guys, quick question, I have a query that will usually return multiple results from a database, while I know how to return one result, I am not sure how to return multiple in jquery. I just want to take each of the returned results and run them through my prepare function. I have been trying to use 'for' to handle the array of data but I don't think it can work since I am returning different array values. If anyone has any suggestions, I would really appreciate it.</p>

<p><strong>JQUERY RETRIEVAL</strong></p>

<pre><code> success: function(json) {

 for(i=0; i &lt; json.rows; i++) {

                $('#users_online').append(online_users(json[i]));
                $('#online_list-' + count2).fadeIn(1500);
} 

} 
</code></pre>

<p><strong>PHP PROCESSING</strong></p>

<pre><code>$qryuserscount1="SELECT active_users.username,COUNT(scrusersonline.id) AS rows FROM scrusersonline LEFT JOIN active_users ON scrusersonline.id=active_users.id WHERE topic_id='$topic_id'";
$userscount1=mysql_query($qryuserscount1);
while ($row = mysql_fetch_array($userscount1)) {
$onlineuser= $row['username'];
$rows=$row['rows'];
if ($username==$onlineuser){
    $str2=  "&lt;a href=\"statistics.php?user=$onlineuser\"&gt;&lt;div class=\"me\"&gt;$onlineuser&lt;/div&gt;&lt;/a&gt;";
    }
else {
$str2= "&lt;b&gt;&lt;a href=\"statistics.php?user=$onlineuser\"&gt;&lt;div class=\"others\"&gt;$onlineuser&lt;/div&gt;&lt;/a&gt;&lt;/b&gt;";
}
$data['rows']=$rows;
$data['entry']=$str1.$str2;
}
</code></pre>

<p><strong>EDIT ONLINE USERS FUNCTION</strong></p>

<pre><code>function online_users(response) {
  count2++;

  var string = '&lt;div class="update-entry"&gt;&lt;li id="online_list-'+count2+'"&gt;'
      + ''+response.entry+''
      +'&lt;/li&gt;&lt;/div&gt;';

  return string;
}
</code></pre>
