This is a discussion on "fetch the ENTIRE array?" within the PHP Forum section. This forum, and the thread "fetch the ENTIRE array? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
fetch the ENTIRE array?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
||||
|
fetch the ENTIRE array?
mysql_fetch_array() returns one row of the results. Is there a way to put ALL the results into a single array? I could do a while loop with mysql_fetch_array to build an array, but that would take up more CPU cycles than I would like.
__________________
echo "Take it easy, ".$CloudedVision; .links { site: other-road-design; blog: only-nerds-allowed; project: resource-fish; organization: ARMIES6; } <quote>"I think it's wrong that only one company makes the game Monopoly" - <name>Steven Wright</name></quote>
Last Blog Entry: More Cheat Sheets (Jul 12th, 2008)
|
|
|
|
||||
|
Re: fetch the ENTIRE array?
Recordsets cannot be returned in a single command to my knowledge.
Looping is a standard practice - even on webforumz. If there was a PHP command (which there may well be) there will STILL be a loop happening except you wont see it, and if the loop didnt happen in PHP, then it would happen on the database.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
||||
|
Re: fetch the ENTIRE array?
I've never heard of such a function or such to do this, but as Rob pointed out, it would still run a loop in the background if such was possible.
|
|
|||
|
Re: fetch the ENTIRE array?
Here is a basic example of how you do the MySQL loop:
$result = mysql_query("SELECT username FROM accounts"); while($row = mysql_fetch_array($result)) { print $row[username]; } This will print out all the usernames from table accounts in your database. Last edited by kerrsmith; Mar 5th, 2008 at 13:42. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Fetch Array problem | Aso | PHP Forum | 3 | Dec 4th, 2007 16:13 |
| Fetch random rows in MySQL | robertboyle | Databases | 2 | Jun 14th, 2006 18:07 |
| Sorting a new array from an existing array | Ozeona | Flash & Multimedia Forum | 2 | Sep 20th, 2005 08:43 |
| array unable to check another array so as to be displayed | Ozeona | Flash & Multimedia Forum | 1 | Aug 5th, 2005 10:26 |
| filling an entire screen | mreif | Web Page Design | 4 | Jul 29th, 2005 23:30 |