[請益]請問一下表格的問題
http://203.71.42.77/view6.php 這是我目前做的網頁
現在是學號 4910K001
姓名 王XX
學號 4910K002
姓名 李XX 這樣累加下去
可是我想要的是
學號4910K001 4910K002 4910K003...
姓名王XX 李XX 林XX....
這樣橫向排列 請問該改哪裡呢
<html>
<head>
<title>學生資料分頁</title>
<head>
<body>
<?
$records_per_page =5;
if (isset($_GET["pages"]))
$pages = $_GET["pages"];
else
$pages=1;
$dbname="class";
$link = mysql_connect("localhost","root","02140423")
or die("無法開啟");
$sql="SELECT * FROM stu";
$result=mysql_db_query($dbname,$sql);
$total_fields =mysql_num_fields($result);
$total_records = mysql_num_rows($result);
$total_pages=ceil($total_records/$records_per_page);
$offset = ($pages -1)* $records_per_page;
mysql_data_seek($result, $offset);
echo "紀錄總數: $total_records<br>";
echo "<table border =3>";
$j=1;
while($rows = mysql_fetch_array($result, MYSQL_NUM)
and $j <= $records_per_page) {
echo"<tr>";
echo"<td>學號</td>";
echo"<td>"."<a href=\"csv4.php\">".$rows[0]."</a>"."</td>";
echo "</tr>";
echo"<tr>";
echo"<td>姓名</td>";
echo"<td>".$rows[1]."</td>";
echo "</tr>";
$j++;
}
echo "</table>";
echo "<br>顯示頁數: ";
for ($i=1; $i <= $total_pages; $i++)
if ($i != $pages)
echo "<a href=\"view5.php?pages=".$i."\">".$i."</a>";
else
echo $i. " ";
mysql_free_result($result);
mysql_close($link);
?>
</body>
</html>
--
We will be good friends for good .
You'll always be my upperclassman ,
and I'll be your lowerclasswoman .
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.71.41.233
推
01/07 08:52, , 1F
01/07 08:52, 1F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
1
1
PHP 近期熱門文章
PTT數位生活區 即時熱門文章