RE: [PHP] Table trouble
| From: | Ralph | Date: | Tue, 08 Jul 2003 00:39:03 +0000 |
| Subject: | RE: [PHP] Table trouble | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154286@lists.php.net to get a copy of this message | ||
> fetchinto?
> On Mon, 2003-07-07 at 14:42, phpu wrote:
> > 10x but i am new to php and i do not know how to dump all of the
results
> > into an array.... can you help me with this one please?
$sql="select * from cate order by name asc";
$resurs=mysql_query($sql);
while ($row=mysql_fetch_array($resurs))
{
$results_array[] = (
'field_1' => $row['1'],
'field_2' => $row['2'],
'field_3' => $row['3']
);
}
echo "<table border=1>\n";
for($i=0; $i<count($results_array);)
{
echo "\t<tr>\n";
for($j=0; $j<2; $j++)
{
echo "\t\t<td>".$results_array[$i]."</td>\n";
$i++;
}
echo "\t</tr>\n";
}