我正在使用屏幕截图中给出的 php 显示 mysql 数据库中的一些字段。实际上,每个人在几个表中都有很多数据。屏幕截图仅显示从几个表中收集的几个。现在要显示与一个人相对应的所有信息,如果字段 usn(比如 10IS037)是一个链接,这样每当我点击任何一个 usn 时,它就会重定向到另一个页面,在该页面将使用一些查询显示整个信息。现在我正在尝试,但我无法建立我们提交的任何链接。请看屏幕截图。
代码的一部分在这里..
<?php
include('includes/login_connection.php');
// $query = "select * from personal_details, course_codes";
$query = "select p.usn, p.name, p.sem, p.year, cg.cur_cgpa, c.cc1, c.cc2, c.cc3, c.cc4, c.cc5, c.cc6, c.cc7, c.cc8, c.cc9 from personal_details p, course_codes c, cgpa_details cg where p.usn = c.usn AND p.usn = cg.usn order by p.usn";
$run = mysql_query($query) or die($query."<br/><br/>".mysql_error());
$num=mysql_numrows($run);
echo "No. of registered students: $num";
while($row = mysql_fetch_assoc($run)){
echo "<tr>";
echo "<td>" . $row['usn'] . " </td>";
echo "<td>" . $row['name'] . " </td>";
echo "<td>" . $row['sem'] . " </td>";
echo "<td>" . $row['year'] . " </td>";
echo "<td>" . $row['cur_cgpa'] . " </td>";
echo "<td>" . $row['cc1'] . " </td>";
echo "<td>" . $row['cc2'] . " </td>";
echo "<td>" . $row['cc3'] . " </td>";
echo "<td>" . $row['cc4'] . " </td>";
echo "<td>" . $row['cc5'] . " </td>";
echo "<td>" . $row['cc6'] . " </td>";
echo "<td>" . $row['cc7'] . " </td>";
echo "<td>" . $row['cc8'] . " </td>";
echo "<td>" . $row['cc9'] . " </td>";
echo "</tr>";
// echo "</table>";
}
mysql_close($bd);
?>
html部分在图片中给出..抱歉我不能粘贴文本
![在此处输入图像描述][2]
<table border='1' align="center" style="font-size:14px" width="95%" cellspacing="3" class="db_table" >
<tr class="db_table_tr" >
<th class="db_table_th" >USN</th>
<th class="db_table_th" >Name</th>
<th class="db_table_th" >Sem</th>
<th class="db_table_th" >Year</th>
<th class="db_table_th" >CGPA</th>
<th class="db_table_th" >Subject-1</th>
<th class="db_table_th" >Subject-2</th>
<th class="db_table_th" >Subject-3</th>
<th class="db_table_th" >Subject-4</th>
<th class="db_table_th" >Subject-5</th>
<th class="db_table_th" >Subject-6</th>
<th class="db_table_th" >Subject-7</th>
<th class="db_table_th" >Subject-8</th>
<th class="db_table_th" >Subject-9</th>
</tr></table>