Try this, it should work for you
if (mysql_num_rows($result) > 0) {
while($row= mysql_fetch_array($result, 1)) {
$my_data[] = $row;
}
return $my_data
}
call the function this way:
$user_data = Inwork($userid);
And each member of the array can be identified as:
$user_data[0];
$user_data[1]
etc
Alternatively, if you plan to process the items before returning them a simple way to go about it is:
if (mysql_num_rows($result) > 0) {
while($row= mysql_fetch_array($result, 1)) {
//Define Session Id Number that is used in Session Variables table
$SessionID = $row[id];
$UserName = $row[UsersName];
// DO SOME STUFF HERE
}
//Or Do More STUFF HERE
//Build array
$my_data_array = array($SessionID, $UserName, $third, $fourth);
// RETURN VALUES TO PAGE
return $my_data_array;
}
You can call it the same way. Also check out the different array function in the manual for walking through etc.
HTH