我想在表中显示数据的这段代码,代码中没有错误,但是即使查询具有我想要的结果,我仍然有一个空表,这里是更多理解的代码
<?php
$connectdb = mysql_connect('localhost','root','sara', true ) or die ("Not Connect");
if (!$connectdb)
{
die('Could not connect :'. mysql_errno());
}
$selestdb = mysql_select_db('iexa', $connectdb) or die ("not selected database");
if (isset($_POST['examID'])) {
$examID = $_POST['examID'];
}
echo $examID;
echo "<br />";
$query = mysql_query("SELECT Question , Choise_1 , Choise_2 , Choise_3 , Choise_4 , Correct_Answer
FROM question_bank WHERE E_No='examID' ORDER BY Question asc") or die ("mysql error");
echo "<table width='40%' border='1' cellpadding='5'>
<tr>
<td>Qusetion </td>
<td>Choise 1</td>
<td>Choise 2</td>
<td>Choise 3</td>
<td>Choise 4</td>
<td>The correct answer</td>
</tr>";
echo $query;
while ($row = mysql_fetch_assoc($query)){
echo '
<tr>
<td>'.$row['Question'].'</td>
<td>' .$row['Choise_1'].'</td>
<td>' .$row['Choise_2'].'</td>
<td>' .$row['Choise_3'].'</td>
<td>' .$row['Choise_4'].'</td>
<td>' .$row['Correct_Answer'].'</td>
</tr>';
};
echo "</table>";
mysql_close($connectdb);
?>