RE: [PHP] SQL Functions

From: Date: Tue, 10 Aug 2004 14:43:28 +0000
Subject: RE: [PHP] SQL Functions
Groups: php.general 
Request: Send a blank email to php-general+get-193278@lists.php.net to get a copy of this message
[snip] I'm trying to build a class to handle various SQL functions. One of them is to take a query, and return all rows. Here's what I have so far: function selectRows( $sql ) { $count = 0; $results = mysql_query( $sql, DB::connect() ); $data = mysql_fetch_array( $results ); return $data; } Right now it only returns 1 row. I'm guessing this is how it should be, considering I haven't looped thru any other rows. What I want to do is return something that holds all the rows, however, I cannot see a decent way of doing this. I've played with putting it into a new array, but I can't decide if that's the best way to do it. [/snip] In order to get all of the data back you are going to have to loop through it and return the array so that it will be available for manipulation.

« previous php.general (#193278) next »