Re: SQL Functions
| From: | pete M | Date: | Wed, 11 Aug 2004 11:29:24 +0000 |
| Subject: | Re: SQL Functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193439@lists.php.net to get a copy of this message | ||
This might be slightly off the topic but I would recommend you use a database abstraction layer which will do what you want to achieve
Check out
Pear DB
http://pear.php.net/manual/en/package.database.db.php
and adodb
http://adodb.sourceforge.net/
pete
Dan Joseph wrote:
Hi Everyone,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 itshould 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.Wondering if I could get some opinions on how you all wouldhandle this? -Dan Joseph