# Array help in php

**URL:** https://forum.kirupa.com/t/array-help-in-php/235889
**Category:** Uncategorized
**Created:** [August 15, 2007, 4:18pm UTC](https://forum.kirupa.com/t/array-help-in-php/235889 "2007-08-15T16:18:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wo1olf](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wo1olf](https://forum.kirupa.com/u/wo1olf)
#### Post date: [August 15, 2007, 4:18pm UTC](https://forum.kirupa.com/t/array-help-in-php/235889/1 "2007-08-15T16:18:28Z")

</div>

i have two table one for reservations and other one for users.With the code below i want to find all the users whose reservations are out to date. Then from that i want to return a multidimensional array containing their informations.  
The problem I’m having is that when i read the array i only have informations for one user only. How can i do to add values to a multidimensional array with keys?

```php
 function reservationsOutDate()
{
   $requete = mysql_query("SELECT*FROM reservations WHERE dateRetour <CURDATE();");
   $list = array();
   while($row = mysql_fetch_array($requete))
  {
    $userInfos = getInfos("users","userName",$row['userName']);
    //the function return an array containing the name, family name and email of the user

       $list = array(
                 $row['userName'] => array(
                                                     "name" => $userInfos['name'],
                                                     "familyName" => $userInfos['familyName'],
                                                     "email" => $userInfos['email']));
  }
  return $list;
}

```
