我有这个脚本可以生成一个基于 MySql 表的 HTML 表。我想让它隐藏第一列。
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<th id = 'tableheader'>{$field->name}</th>";
}
echo "</tr>\n";
echo "<tr><td id = 'line'></td id = 'line'><td id = 'line' ></td><td id = 'line' ></td><td id = 'line' ></td><td id = 'line' ></td></tr>";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td id = 'tabledata'>$cell</td>";
echo "<td><form method='post' action='delete.php'><input type='hidden' name='id' value='{$row['0']}'/><input type='submit' value='Delete'/></form></td>";
echo "</tr>\n";
}