我遇到了我正在處理的PHP頁面的問題。如何調試導致白屏的PHP/HTML頁面?
我有一個list.php是從MySQL數據庫中調用數據,一個config.php作爲連接頁面到我的數據庫。下面是我的edit.php頁面,當我查看它時,它完全是空白的。我的代碼在哪裏出錯了?
URL字符串http://localhost/example/edit.php?id=382(應召回的382客戶端ID編輯)`
<html>
<body>
<?php
include('config.php');
if(isset($_GET['cx_id']))
{
$id=$_GET['cx_id'];
if(isset($_POST['submit']))
{
$name=$_POST['Name'];
$address=$_POST['Address'];
$query3=mysqli_query("update restrictedkeys set Name='$name', Address='$address' where cx_id='$id'");
if($query3)
{
header('location:list.php');
}
}
$query1=mysqli_query("select * from restrictedkeys where cx_id='$id'");
$query2=mysqli_fetch_array($query1);
?>
<form method="post" action="">
Name:<input type="text" name="name" value="<?php echo $query2['Name']; ?>" /><br />
Address:<input type="text" name="address" value="<?php echo $query2['Address']; ?>" /><br /><br />
<br />
<input type="submit" name="submit" value="update" />
</form>
<?php
}
?>
</body>
</html>
http://stackoverflow.com/a/21429652/2506641 – 2016-11-21 23:07:15
注意SQL注入漏洞 - 有人可以使用該代碼擦除'restrictedkeys'中每行的所有列值。 – halfer
只是一條建議,請使用SQL參數綁定來避免SQL注入。 :) – Ronald