fetch the ENTIRE array?

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 4th, 2008, 02:14
CloudedVision's Avatar
Nerdy Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 942
Blog Entries: 8
Thanks: 2
Thanked 22 Times in 22 Posts
Send a message via AIM to CloudedVision Send a message via MSN to CloudedVision Send a message via Skype™ to CloudedVision
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>&quot;I think it's wrong that only one company makes the game Monopoly&quot; - <name>Steven Wright</name></quote>
Last Blog Entry: More Cheat Sheets (Jul 12th, 2008)
Reply With Quote

  #2 (permalink)  
Old Mar 4th, 2008, 07:33
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
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
Reply With Quote
  #3 (permalink)  
Old Mar 5th, 2008, 03:57
Weird1993's Avatar
Moderator
Join Date: Feb 2007
Location: United States
Age: 15
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Weird1993 Send a message via Skype™ to Weird1993
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.
__________________
Daniel Thompson
danielwthompson.com
Reply With Quote
  #4 (permalink)  
Old Mar 5th, 2008, 13:38
Junior Member
Join Date: Sep 2007
Location: uk
Age: 32
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
Reply

Thread Tools

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 05:55.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43