在数据库中显示表和数据不会显示

时间:2015-02-17 19:29:03

标签: php mysql

我有这个问题,我的表没有显示,我的数据库中的所有信息都没有显示也可以帮助我吗?输出仅显示“学生编号名字中间名姓名主题代码单元最终 ...“。我在数据库中的信息没有显示,我创建的表也没有显示。任何答案如何修复此代码?感谢

 <?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "tsukishiro";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} 
$sql = "SELECT * FROM student_grades WHERE Student_ID='c2011-02529' ";
$result = $conn->query($sql);


echo "<table>";
echo "<tr><th>Student No.</th><th>First Name</th><th>Middle Name</th><th>Last Name</th><th>Subject Code</th><th>Units</th><th>Final Grade</th><th>Remarks</th><th>Professor</th></tr>";

while($row = mysqli_fetch_array($result)) {

$Student_ID = $row['Student_ID'];
$First_Name = $row['First_Name'];
$Middle_Name = $row['Middle_Name'];
$Last_Name = $row['Last_Name'];
$Subject_Code = $row['Subject_Code'];
$Units = $row['Units'];
$Final_Grade = $row['Final_Grade'];
$Remarks = $row['Remarks'];
$Professor = $row['Professor'];

echo "<tr><td>".$Student_ID."</td><td>".$First_Name."</td><td>".$Middle_Name."</td><td>".$Last_Name."</td><td>".$Subject_Code."</td><td>".$Units."</td><td>".$Final_Grade."</td><td>".$Remarks."</td><td>".$Professor."</td></tr>";

} 
echo "</table>";
$conn->close();
?>

这是<table border='1' cellpadding='2' cellspacing ='2'><tr><td>Student No.</td><td>First Name</td><td>Middle Name</td><td>Last Name</td><td>Subject Code</td><td>Units</td><td>Final</td></tr></table>... </div> 这是该页面中唯一的代码

0 个答案:

没有答案