Bluehost.com Web Hosting $6.95

Re: php mysql array question

This is a discussion on Re: php mysql array question within the PHP General forums, part of the PHP Programming Forums category; It shouldn't take a lot of code to put results into an array: $query = "select * from table"; $...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-11-2003
Rob Adams
 
Posts: n/a
Default Re: php mysql array question

It shouldn't take a lot of code to put results into an array:
$query = "select * from table";
$r = mysql_result($query);
while ($row = mysql_fetch_object($r))
$hold[] = $row;
(OR, to index by some id field in the database:)
$hold[$row->id] = $row;
mysql_free_result($r);

Total of 5 lines.

-- Rob




"Larry Brown" <larry.brown@dimensionnetworks.com> wrote in message
news:CBECIONKKLMDDCIKHALJAECJIAAA.larry.brown@dime nsionnetworks.com...
> Is there any php function to pull a query into an array? I know there is

a
> way to get the first row of the results in an array, but I'm having to

loop
> through each row pushing the row onto an array to get the result I'm

looking
> for and it seems like a lot of code for something that I would think is

used
> a lot.
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:29 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0