[請益] php & xhtml
今天第一次碰php & mysql
但剛剛忙了一個早上
發現如果用xhtml的方法來表示 table
會無法顯示 @@
但是一改成html就成功顯示...
是我的方法錯誤...還是php 和 xhtml本來就不相容呢?
code
-----------------------------
<?php
$link = mysql_pconnect("localhost", "xxxxxx", "");
mysql_select_db("shopping") or die("無法選擇資料庫");
$query = "SELECT * FROM product";
$result = mysql_query($query) or die("無法送出" . mysql_error( ));
echo "<table summary="教師資料">";
echo "<colgroup span="1"></colgroup>";
echo "<colgroup span="2"></colgroup>";
echo "<colgroup span="3"></colgroup>";
echo "<colgroup span="4"></colgroup>";
echo "<colgroup span="5"></colgroup>";
echo "<colgroup span="6"></colgroup>";
echo "<thead>";
echo "<tr>";
echo "<th scope="col">product_id</th>";
echo "<th scope="col">product_name</th>";
echo "<th scope="col">price</th>";
echo "<th scope="col">category</th>";
echo "<th scope="col">product_family</th>";
echo "<th scope="col">product_class</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while ( $row = mysql_fetch_array($result) ){
echo "<tr>";
echo "<td scope="row">".$row['product_id']."</td>";
echo "<td scope="row">".$row['product_name']."</td>";
echo "<td scope="row">".$row['price']."</td>";
echo "<td scope="row">".$row['category']."</td>";
echo "<td scope="row">".$row['product_family']."</td>";
echo "<td scope="row">".$row['product_class']."</td>";
echo "</tr>";
}
echo "</tbody></table>";
mysql_free_result($result);
?>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.172.78.11
推
12/17 13:31, , 1F
12/17 13:31, 1F
討論串 (同標題文章)