Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 647 Bytes

0716.md

File metadata and controls

23 lines (19 loc) · 647 Bytes

What is wrong in the following code (assume that $db is an instance of mysqli, mytable exists and has a column called student):

$sql = "SELECT student FROM mytable WHERE student = '$_POST["student"]'";
if ($result = $db->query($sql)) {
    while($row = $result->fetch_object())
        echo $row->student;
}
  • A) The script is vulnerable to SQL Injection
  • B) Nothing is wrong
  • C) An XSS atack
  • D) It is not PHP 7 valid code
Answer

Answer: D