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

Reply via email to