Answers for "how to check if record updated or not in php pdo"

PHP
0

php pdo check if record exists before insert

$sql = $dbh->prepare("SELECT COUNT(*) AS `total` FROM directory WHERE telephone = :phone");
$sql->execute(array(':phone' => $telephone));
$result = $sql->fetchObject();

if ($result->total > 0) 
{
    echo 'The telephone number: ' . $telephone. ' is already in the database<br />';
}
else 
{
      echo 'No rows matched the query.';
}
Posted by: Guest on October-01-2021
0

pdo insert or update if exists

REPLACE INTO ***** SET name = ?, slideView = ?, company = ?
Posted by: Guest on August-04-2020

Code answers related to "how to check if record updated or not in php pdo"

Browse Popular Code Answers by Language