RE: [PHP] SQL Functions

2004-08-10 Thread Jay Blanchard
[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 =

RE: [PHP] SQL Functions

2004-08-10 Thread Dan Joseph
Hi, 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. Hmm.. I suspected this might be the case. I have modified my functiona bit: function selectRows( $sql )

Re: [PHP] SQL Functions

2004-08-10 Thread John W. Holmes
From: Dan Joseph [EMAIL PROTECTED] 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. Hmm.. I suspected this might be the case. I have modified my functiona bit: function

RE: [PHP] SQL Functions

2004-08-10 Thread Dan Joseph
Hi, $array = array(); $results = mysql_query( $sql, DB::connect() ); while($data = mysql_fetch_array($result)) { $array[] = $data; } return $array; No need to loop through $data. Ahh, thanks for that tip. That's much cleaner. -Dan Joseph -- PHP General Mailing List

Re: [PHP] SQL Functions

2004-08-10 Thread John Nichel
John W. Holmes wrote: Change that to: $array = array(); $results = mysql_query( $sql, DB::connect() ); while($data = mysql_fetch_array($result)) { $array[] = $data; } return $array; Would there be any speed/performance issuse with using something like... array_push ( $array, $data ); vs. $array[]

RE: [PHP] SQL Functions

2004-08-10 Thread Dan Joseph
Hi, Would there be any speed/performance issuse with using something like... array_push ( $array, $data ); vs. $array[] = $data; They seem to react the same in my test script. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] SQL Functions

2004-08-10 Thread Robby Russell
On Tue, 2004-08-10 at 08:33, John Nichel wrote: John W. Holmes wrote: Change that to: $array = array(); $results = mysql_query( $sql, DB::connect() ); while($data = mysql_fetch_array($result)) { $array[] = $data; } return $array; Would there be any speed/performance issuse

Re: [PHP] SQL Functions

2004-08-10 Thread John Nichel
Robby Russell wrote: Run some tests and let us know. ;-) I'd be interested in knowing as well. Not really worth worrying about according to this... array_push() averaged 0.20226655006409 seconds when running the test 10 times array[] averaged 0.20317406654358 seconds when running the test 10

Re: [PHP] SQL Functions

2004-08-10 Thread raditha dissanayake
John Nichel wrote: John W. Holmes wrote: Change that to: $array = array(); $results = mysql_query( $sql, DB::connect() ); while($data = mysql_fetch_array($result)) { $array[] = $data; } return $array; Would there be any speed/performance issuse with using something like... array_push ( $array,

Re: [PHP] SQL Functions

2004-08-10 Thread Justin Patrin
On Tue, 10 Aug 2004 10:31:36 -0400, Dan Joseph [EMAIL PROTECTED] 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 ) {

RE: [PHP] SQL Functions

2004-08-10 Thread Dan Joseph
Hi, Of course, this begs the question of why you're re-implementing what has been done so many times in the past. http://pear.php.net/package/DB http://pear.php.net/package/MDB http://pear.php.net/package/MDB2 http://adodb.sourceforge.net/

Re: [PHP] SQL Functions

2004-08-10 Thread Justin Patrin
On Tue, 10 Aug 2004 13:37:50 -0400, Dan Joseph [EMAIL PROTECTED] wrote: Hi, Of course, this begs the question of why you're re-implementing what has been done so many times in the past. http://pear.php.net/package/DB http://pear.php.net/package/MDB http://pear.php.net/package/MDB2

RE: [PHP] SQL Functions

2004-08-10 Thread Dan Joseph
I'm building a class for use with our PHP applications. Packages like what you've linked me to are nice, but we need a little flexibility here, so we're writing a few methods of our own. Flexibility?? Those classes are very flexible and have many useful utility methods. In

Re: [PHP] SQL Functions

2004-08-10 Thread John W. Holmes
From: Dan Joseph [EMAIL PROTECTED] Of course, this begs the question of why you're re-implementing what has been done so many times in the past. http://pear.php.net/package/DB http://pear.php.net/package/MDB http://pear.php.net/package/MDB2 http://adodb.sourceforge.net/

RE: [PHP] SQL Functions

2004-08-10 Thread Ed Lazor
http://pear.php.net/package/DB http://pear.php.net/package/MDB http://pear.php.net/package/MDB2 http://adodb.sourceforge.net/ http://www.phpclasses.org/browse/package/20.html I'm building a class for use with our PHP applications. Packages like what you've linked me

Re: [PHP] SQL Functions

2004-08-10 Thread Michael Collins
At 10:26 AM -0700 8/10/04, Justin Patrin wrote: Of course, this begs the question of why you're re-implementing what has been done so many times in the past. At 11:56 AM -0700 8/10/04, Ed Lazor wrote: Hey, while you guys are talking about those DB classes, I've always opted to not use them because