Re: a generic getsql() function
| From: | Don Read | Date: | Wed, 25 Jun 2003 16:46:41 +0000 |
| Subject: | Re: a generic getsql() function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152817@lists.php.net to get a copy of this message | ||
On 25-Jun-2003 Thomas Hochstetter wrote:
> 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!!!
Nothing will happen here!!!
You've already returned from the function.
> }
<snipage>
Regards,
--
Don Read dread@ispwest.com
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.