a generic getsql() function

From: Date: Wed, 25 Jun 2003 09:21:03 +0000
Subject: a generic getsql() function
Groups: php.general 
Request: Send a blank email to php-general+get-152729@lists.php.net to get a copy of this message
Hi guys, I wrote a generic getsql() function for my project's class. However, I only manage to retrieve a single row. What it should really do is: Read all rows into the array (with multiple results). The code is below: function getsql($sql,$conn,$dbase,&$arr) { if($conn) { mysql_select_db($dbase,$conn); $result = mysql_query($sql,$conn); while ($arr = mysql_fetch_assoc($result)) { return $arr; // Something has to happen here!!! } } else { $arr["Error"] = "No connection"; return $arr; } } Thanks. Thomas

« previous php.general (#152729) next »