update....
ok i can now get the info that i want, the id#
the problem i am now having is that for some reason all my double digit id#s get separated like so...... 15 18 3 2 14 would read out 1 5 1 8 3 2 1 4....
can anybody please help.......
here is my two codes...
php code
<?php
$userid = $_GET['uid'];
$index = 0;
$ids = array();
$query = null;
//open connection to db.
$connection = mysql_connect($host, $user, $pass)
or die ('unable to connect!');
//select database to use.
mysql_select_db($db) or die ('unable to select database!');
$query = "select friendid, friendname from friends where myid = '" . $userid . "' and status = 'accepted'";
$result = mysql_query($query);
$query = null;
header("Content-Type: plain/text");
while ($row = mysql_fetch_row($result))
{
$id = $row[0];
print $ids[$index] = $id;
$index ++;
}
mysql_free_result($result);
//close database
mysql_close($connection);
?>
and the part of my ajax that handles this is
this.sort = function(str) {
var self = getfriends;
var newdiv = null;
var id = '';
var ids = str;
var div = self.Div;
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
newdiv = document.createElement('div');
newdiv.id = 'test';
newdiv.appendChild(document.createTextNode(id));
div.appendChild(newdiv);
}
};