私のページには、テーブル(MySQLのコンテンツ)とフッタ(require_once()を使用)があります。PHP/MySQL:テーブルの前にフッタが表示される
問題は、「require_once( "footer.php");コード行は私のテーブルの表示コードの後にあり、フッタは私のテーブルの上に表示されます。
ここに私のコードは次のとおりです。
$table='mytable';
$result = mysql_query("SELECT * FROM {$table}");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
//echo "<h1>Table: {$table}</h1>";
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// 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>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
?>
<?
require_once("footer.php");
?>
ありがとう!
を入れ
はあなたにみんなありがとう!私はそのテーブルのタグを見逃しているに違いない。 – user1261817