Printing rows from a table, and the foreach loop
Posted: Fri Dec 17, 2004 8:31 am
Hi All,
I am trying to get some data from a table to display as hyperlinks within a html table, and am having some problems.
I'm getting the following error:
Here is my code
Can someone suggest what is wrong, or a different way to approach it?
Many thanks
I am trying to get some data from a table to display as hyperlinks within a html table, and am having some problems.
I'm getting the following error:
Code: Select all
invalid argument supplied for foreach()Code: Select all
function writeList()
{
$result=mysql_query("select * from ws_basic order by site_name") or die(mysql_error());
$list=mysql_fetch_array($result);
echo "<tr>\n";
echo "<td align='center'>Current Web Servers</td>\n";
foreach($list as $record)
{
echo "<tr>\n";
echo "<td><a href="ws_update_detail.php?siteid=$record[server_no]&".SID."">".html($record[site_name])."</a></td>\n";
echo "</tr>\n";
}
}Many thanks