Sorting multidimensional arrays from mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Morning all,

I am having problems understanding what I need to do. Usually for most of my work, all i need to do is pull the information and place it like this:

function office_list(){
   global $link;
   echo "<table><tr>";
   $sql = "SELECT town
           FROM offices";
   $result = mysql_query($sql, $link);
   while ($array = mysql_fetch_array($result)){
       $office = $array['town'];
       $state = $array['state'];
       $zip = $array['zip'];
       echo "<td>$office</td>
                   <td>$state</td>
                   <td>$zip</td>";
   }
   echo "</tr></table>";
}

But now I need to separate the information in order to build a more complex table. I do not understand how to obtain each cell. I have a fixed number so it will never change.
I thought multidimensional arrays came as array[0][0], but when i try


$office = $array['town'][0]

I just get the first letter of that office. If someone could point me in the right direction I'd greatly appreciate it. I think I just do not know the terminology I am looking for. The PHP manual keeps brining me to pages that are not what I need.
Thank you,
jozef


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux