Sorting multidimensional arrays from mysql

From: Date: Mon, 02 May 2005 13:41:34 +0000
Subject: Sorting multidimensional arrays from mysql
Groups: php.db 
Request: Send a blank email to php-db+get-39337@lists.php.net to get a copy of this message
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

« previous php.db (#39337) next »