pdo prepare sql code example
Example 1: pdo db connection
<?php
$pdo = new PDO('mysql:host=localhost;dbname=databasename', 'username', 'password');
?>
Example 2: update number in sql pdo php not working
<?php
include("php-includes/check-login1.php");
echo $username;
$profile = "0";
require_once("config/pdo.php");
$data = [
'profile' => $profile,
'username' => $username,
];
$sql = "UPDATE customer SET photoup=:profile WHERE mmob=:username";
$stmt= $conn->prepare($sql);
$stmt->execute($data);
if($stmt){
echo "success";
}
else
{
echo "error";
}
?>