$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>"; }
Secure SQL query
Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
More
lil-code© | 2022 - 2024
Go Top