Re: Query result to an array

From: Date: Thu, 12 Sep 2002 07:55:08 +0000
Subject: Re: Query result to an array
Groups: php.general 
Request: Send a blank email to php-general+get-116096@lists.php.net to get a copy of this message
> $result = mysql_query(...); > while( $t = mysql_fetch_row($result) ){ > $array[] = $t; > } No. I need a 2 dimensions arrays, each line of this array, is the result of one row of the query and each cell of this row is a field from the select. Example, the query return 2 row and 3 fields for each row : "Christian", "Ista", "Belgium" "zak", "PhpNet", "Dontknowfrom" resulf of SELECT NAME, LASTNAME, COUNTRY FROM MyTable; I'd like to put that in an array and later because I use a session array. I'd like via a for loop access these data by echo(MyArray[1][1]); result is "PhpNet" echo(MyArray[0][2]); result is "Belgium" echo(MyArray[1][0]); result is "zak" Is it clearer now ? Thanks, Christian

« previous php.general (#116096) next »