0
即时工作在学生管理页面,我在编辑页面显示学生数据有点问题,以确定我点击编辑时使用传递ID的学生。传递学生ID到编辑页面
我的编辑页面查询
<?php
$user = $_GET["id"];
$query = "SELECT * FROM kuala_lumpur UNION ALL
SELECT *FROM eastern UNION ALL
SELECT *FROM northern UNION ALL
SELECT * FROM sabah UNION ALL
SELECT * FROM sarawak
WHERE ID_NO = '$user'";
$result = mysqli_query($conn,$query) or die ('query die');
$userget =mysqli_fetch_assoc($result);
?>
<div class="thebox thebox-more">
<form method="post">
<table class="table tablo center-hr " border="0">
<tr><th colspan="6"><h3>Student Information</h3></th>
<tr class="text-right">
<td><label>Name</label></td>
<td colspan="5"><input type="text" name="NAME" value="<?php echo $userget['NAME']; ?>"></td>
<tr class="text-right">
<td><label>Student IC</label></td>
<td colspan="2"> <input type="text" name="IC_NO" value="<?php echo $userget['IC_NO']; ?>" ></td>
<td><label>Student ID</label></td>
<td colspan="2"> <input type="text" name="ID_NO" value="<?php echo $userget['ID_NO']; ?>"></td>
</tr></i>
我的表的学生名单
$th1 = 'Student ID';
$th2 = 'Name';
$th3 = 'Course';
$th4 = 'Convocation Date';
$th5 = 'Edit';
$td1 = 'ID_NO';
$td2 = 'NAME';
$td3 = 'PROGRAM_CODE';
$td4 = 'CONVO_DATE';
$td5 = 'PROGRAM_DESC';
<div class ="table tbody" >
<table class="table table-hover bg-brand" data-toggle="table" >
<?php
if (mysqli_num_rows($query) > 0) {
echo "<thead>
<tr>
<th class='text-center'>".$th1."</th>
<th class='text-center'>".$th2."</th>
<th class='text-center'>".$th3."</th>
<th class='text-center'>".$th5."</th>
</tr>
</thead>";
while($row = mysqli_fetch_assoc($query)) {
echo "<tbody>
<tr>
<td class='text-center'>".$row[$td1]."</td>
<td>".$row[$td2]."</a><br>
<b style='padding-left:7px;'><i>".$row[$td5]."</i></b></td>
<td class='text-center'>".$row[$td4]."</td>
<td><center><a href=\"info.php?id={$row[$td1]}\">X</a></center></td></tr>
</tr>
</tbody>";
}
}?>
</i>
的显示的不是后更改数据我点击其他学生进出口新的UNION ALL
我有一种感觉在查询中的问题,但我试着改变很多次,但仍然没有运气...
omg哈哈不知道它的这么简单,这使我狩猎了好几天,但你解决它在分钟大声笑....我有另一个问题如何使用更新联盟?和上面一样吗?或有点不同? –
那么每个地区的数据库设计都有单独的表格,这有点尴尬。它可能有助于在数据中包含该区域,例如:'SELECT'sarawak'as region,* FROM sarawak WHERE ID_NO ='$ user''因此您可以在稍后进行更新时使用该区域。 – Adder