Re: [PHP] Mysql Help #2

2001-08-03 Thread Tom Carter

Depends what is to happen to the array afterwards, but in general no.

An interesting thing is to put timing method calls around a block of code in
question, you will find something like this (depending upon size of db)
takes somehting like 0.005 seconds. Timing things can be useful measures of
a pages overhead (one page on a site I hvae currently takes almost 2 seconds
on average to build...eek!)

"elias" <[EMAIL PROTECTED]> wrote in message

- Original Message -
From: "elias" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 02, 2001 9:31 AM
Subject: [PHP] Mysql Help #2


> Hi again.
>
> $result = mysql_query("SELECT id FROM table");
> $id_array = array();
>
> while ($r = mysql_fetch_array($result))
>$id_array[] = $r["id"];
>
> // now $id_array[] is an array of IDs that was grabbed from the database.
>
> Any faster and/or better approache to build the $id_array?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Mysql Help #2

2001-08-02 Thread Miles Thompson

Looks fine to me
Miles

At 10:31 AM 8/2/01 +0200, elias wrote:
>Hi again.
>
>$result = mysql_query("SELECT id FROM table");
>$id_array = array();
>
>while ($r = mysql_fetch_array($result))
>$id_array[] = $r["id"];
>
>// now $id_array[] is an array of IDs that was grabbed from the database.
>
>Any faster and/or better approache to build the $id_array?
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]