不显示我需要help.i有这个数据库数据库并使用GET方法
student_code: 1234
student_id: angel
namaFoto: angel.jpg
使用GET method
从数据库中调用特定的数据,我用这个代码以下,但数据并没有显示出来。我做错了什么?
<?php
include_once "library/inc.sesadmin.php";
$row \t = 25;
$hal \t = isset($_GET['hal']) ? $_GET['hal'] : 1;
if($usertype != 'Admission'||$usertype != 'Administrator'){
if($_GET) {
\t $Kode \t = $_GET['Kode'];
\t $myQry=$db->prepare("SELECT * FROM student WHERE student_code='$Kode'");
\t $myQry->execute();
$myQryCount = $myQry->rowCount();
\t while ($myData = $myQry->fetch()) {
\t }
}
?>
<table >
<tr>
<td ><img src="foto/<?php echo $namaFoto; ?>"></td>
<td ><b>Code</b></td>
<td ><b>:</b></td>
<td ><?php echo $myData['student_code']; ?></td>
</tr>
<tr>
<td><b>Student ID </b></td>
<td><b>:</b></td>
<td> <?php echo $myData['student_id']; ?> </td>
</tr>
</table>
<?php } else { ?>
<br /> <br /> <br /> <br /> <br /> <br />
<p align="center">You are not authorized to access this area</p>
<?php } ?>
**警告**:由于在查询中使用了用户数据,因此存在一些严重的[SQL注入漏洞](http://bobby-tables.com/)。尽可能使用**准备好的陈述**。这些在['mysqli'](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php)和[PDO](http://php.net/manual/)中很简单en/pdo.prepared-statements.php)其中任何用户提供的数据都是用'?'或':name'指示符指定的,后者使用'bind_param'或'execute'填充,具体取决于您使用的是哪一个。 **绝不**将'$ _POST','$ _GET'或任何用户数据直接放入您的查询中。 – tadman
get变量是否来自html表单或URL?同时检查它是否为空 – Akintunde007
您可能有SQL错误,或者您可能没有运行您认为自己的查询。 – tadman