我有2個文件,一個是用來查看在MySQL數據庫中的數據,並列出其在表中的數據:如何從其他PHP腳本
if($_POST['general'] == 'ADDRESS'){
$result2 = mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'");
echo "<table border='1'>
<tr>
<th>IDNO</th>
<th>ADDRESS</th>
<th>LASTNAME</th>
<th>FIRSTNAME</th>
<th>VIEW</th>
</tr>";
while($row = mysql_fetch_array($result2))
{
echo "<tr>";
echo "<td>" . $row['IDNO'] . "</td>";
echo "<td>" . $row['ADDRESS'] . "</td>";
echo "<td>" . $row['LASTNAME'] . "</td>";
echo "<td>" . $row['FIRSTNAME'] . "</td>";
echo "<td><a href='update.php?id=" . $row['IDNO'] . "'>view</a></td>";
echo "</tr>";
}
echo "</table>";
}
而這一次是update.php我正在工作,我只是希望能夠看到與我點擊第一個使用鏈接「視圖」的記錄相對應的數據。
<?php
mysql_select_db("school", $con);
$result3 = mysql_query("SELECT * FROM student WHERE IDNO='?'");
?>
<tr>
<td width="30" height="35"><font size="3">*I D Number:</td>
<td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["IDNO"]; ?>"></td>
</tr>
但我不知道我怎麼把兩者聯繫起來,以這樣的方式,在這裏相應的數據:
echo "<td><a href='update.php?id=" . $row['IDNO'] . "'>view</a></td>";
將在這裏得到體現:
<td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["IDNO"]; ?>"></td>
</tr>
請給我一個關於如何做到這一點的想法,謝謝。