Array Problem
Posted: Fri Sep 02, 2005 11:30 am
Ok I feel like a right fool at the moment, and I'm sure one of you will make me feel worse lol.
I cant seem to get the array to remember the previous while loops. Does anyone have any idea on a better way for me to do this? The only problem I'm having is the data seems to be added to the array, then the array id counts up on the next while loop and the previous data is gone. grrr
Code: Select all
$username_area_id=$_SESSION['username_login'];
$result_area_id=mysql_query("SELECT helpdesk_areas.id, helpdesk_areas.aname FROM helpdesk_users, helpdesk_areas2users, helpdesk_areas WHERE helpdesk_users.username='$username_area_id' AND helpdesk_users.id=helpdesk_areas2users.user_id AND helpdesk_areas2users.area_id=helpdesk_areas.id");
$num_area_id=mysql_numrows($result_area_id);
$i_area_id=0;
$array_area_info = array();
while ($i_area_id < $num_area_id) {
$temp_area_id = mysql_result($result_area_id,$i_area_id,"helpdesk_areas.id");
$temp_area_aname = mysql_result($result_area_id,$i_area_id,"helpdesk_areas.aname");
$array_area_info = array($i_area_id => array("id" => "$temp_area_id","aname" => "$temp_area_aname"));
$i_area_id++;
}