Secure SQL query open

Secure SQL query

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
$country_code = 'AFG';
if($stmt = $db->prepare("SELECT Name, Population FROM city WHERE CountryCode = ?")){
    $stmt->bind_param('s', $country_code);
    $stmt->execute();
    $stmt->bind_result($name, $population);
    while ($stmt->fetch()){
        echo "Name: {$name}; Population: {$population}<br>";
    }

0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation