-4
我嘗試從下面的數據庫中提取數據,因此,例如,如下所示是低風險,我想顯示一幅圖像並且平均風險下顯示另一幅圖像。但它不起作用。哪裏不對?while if else else
<?php
if ($_POST) {
$ara = $_POST["ara"];
$sorgu = mysqli_query($baglan, "select Risk from wanbetaler where BTW like '%$ara%'");
if (empty($ara)) {
echo 'GEEN RESULTAAT';
} else {
if (mysqli_num_rows($sorgu) > 0) {
while ($kayit = mysqli_fetch_array($sorgu)) {
if ($kayit = "Low risk") {
echo '<center> <img src="groen.jpg" class="center" /></center>';
} elseif ($kayit = "Average risk") {
echo '<center> <img src="oranje.JPG" class="center" /></center>';
}
}
} else {
echo 'GEEN RESULTAAT';
}
}
} else {
}
?>
「不工作」 - 它有什麼作用 – clearshot66
[小博](http://bobby-tables.com/)說***腳本是在對SQL注入攻擊的風險。( http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php)***瞭解[編寫](http://en.wikipedia.org/wiki/Prepared_statement )[MySQLi]的聲明(http://php.net/manual/en/mysqli.quickstart.prepared-statements.php)。即使[轉義字符串](http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string)是不安全的! –