Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: multi dimensional array


Message #1 by "Bernhard Doebler" <programmer@b...> on Fri, 28 Sep 2001 13:16:46 +0200
Hi,

I query a database and strore the data for further use in a multi 
dimensional array this way:

$Abfrage=3D"SELECT Kundenname, KID FROM kunden";

$erg=3Dmysql_db_query($db, $Abfrage);

if (mysql_num_rows($erg)>0) {

$zaehl=3D0;

while($row =3D mysql_fetch_array($erg)) {
     $arr[$zaehl][0]=3Dtrim($row["Kundenname"]);
     $arr[$zaehl][1]=3Dtrim($row["KID"]);
     $zaehl++;
}

Now I want to iterate through the array.
Please tell me how to use each() and list() on multi dimensional arrays.

Are ther better Arrays than mine? Better ways to create than I do?
I have a certain amount of lines and two columns. How ist such data best 
stored in PHP?

Best regards and thanks in advance
Bernhard


  Return to Index