0
我已经使用urldecode
从以前的站点接收成员ID。正确的ID显示在URL中,但我无法从数据库中获取信息。urldecode出错并从数据库中获取信息
<?php
$id = urldecode(trim($_GET['memberID']));
$query = "SELECT * FROM members WHERE memberID = '".$id."'";
if ($result = $db->query($query)) {
while ($row = $result->fetch_assoc()){
printf("%s (%s)\n", $row["memberID"], $row['name']);
}
}
?>
我得到的只是一个空白屏幕。
您正在使用[**的**过时的数据库API(http://stackoverflow.com/q/12859942/19068),并应使用[现代更换(HTTP: //php.net/manual/en/mysqlinfo.api.choosing.php)。你也**易受[SQL注入攻击](http://bobby-tables.com/)**,现代的API会使[防御]更容易(http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php)自己从。 – Quentin
啊,谢谢你指出。我现在更新了它。 –