I'm looking for a native method for taking all of the values from one
column of a query result and creating an array of those values.
Procedurally, I'd tend to want to do this:
?php
$my_id_array = array();
$query_result = $_DB-query(SELECT my_id FROM my_table);
while ($row =
Hi!!
What I do is just this:
$_ar = array();
while($_field = mysql_fetch_row($_result))
{$_aloft[$_field[0]] = $_field[1];}
while(list($_key,$_val) = each($_ar))
On 8/30/06, Christopher Watson [EMAIL PROTECTED] wrote:
I'm looking for a native method for taking all of the values
$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
$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
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On September 12, 2002 01:55, Christian Ista wrote:
$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
Hello,
A query return x rows, by rows there are 4 fields. I'd like to put the
result in an array, a 2 dimensions array. Could you tell me how to do
that ?
Bye
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On September 11, 2002 14:12, Christian Ista wrote:
Hello,
A query return x rows, by rows there are 4 fields. I'd like to put the
result in an array, a 2 dimensions array. Could you tell me how to do
that ?
Something like this may work for
while( $temp = mysql_fetch_row($mysql_result_handle) ) {
$array[] = array(
'key0' = array(
'keya' = $temp[0],
'keyb' = $temp[1],
),
'key1' = array(
'keya' = $temp[2],
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On September 11, 2002 15:05, Christian Ista wrote:
while( $temp = mysql_fetch_row($mysql_result_handle) ) {
$array[] = array(
'key0' = array(
'keya' = $temp[0],
'keyb' = $temp[1],
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On September 11, 2002 15:21, Christian Ista wrote:
while( $temp = mysql_fetch_row($mysql_result_handle) ) {
$array[] = array(
'key0' = array(
'keya' = $temp[0],
'keyb' = $temp[1]
array(
array( $temp[0], $temp[1] ),
array( $temp[1], $temp[2] )
)
I thinks it's not the right way.
I have a query, this query can return 1,5,20, 200, ... rows, each row has
5 fields (or more or less).
I'd like a 2 dimensions array, one line by row and each cell is a field
Message-
From: Christian Ista [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 4:56 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Query result to an array
array(
array( $temp[0], $temp[1] ),
array( $temp[1], $temp[2] )
)
I thinks it's
Here's a function I wrote...feel free to use it. It will convert anything
into a 2D array.
Sample Table:
ID Name
1Bob
2Joe
3Eric
4Cody
$query=select * from sampletable;
$result=mysql_query($query);
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On September 12, 2002 00:56, Christian Ista wrote:
array(
array( $temp[0], $temp[1] ),
array( $temp[1], $temp[2] )
)
I thinks it's not the right way.
I have a query, this query can return 1,5,20, 200, ... rows, each row has
5
14 matches
Mail list logo