February 2019
Beginner to intermediate
366 pages
7h 49m
English
Analyze the following snippet of PHP code:
ini_set('display_errors', 0);
$connection = $GLOBALS['connection'];
$id = ($_POST['id']);
$query_statement = "SELECT * from polls where id = ".$id;
$result = $conection->query($query_statement);
if ($result->num_rows > 0 ){
while($row = $result->fetch_assoc()){
echo "<p class=''>Thank you for your response!</p>";
}
}
This code uses the $id variable, which is a number, to pass information to a query that is directly executed on the database in a SELECT statement. The $id variable is used in a WHERE expression to look for the exact $id variable passed by the user and only display filtered information depending on the number in the variable $id variable.
The most important thing about ...
Read now
Unlock full access