When using PDO, the database connection is normal, but when running this code, the page displays neither results nor errors. Is it because PDO on my side cannot call its method?
<?php
/**
PDO connection database
*/
include 'pdo_conf.php';
$dsn = "{$dbType}:host ={$host};dbName={$userName}";
try{
$pdo = new PDO($dsn,$userName,$password);
// echo '<h3>Connect Success</h3>';
$sql = "UPDATE `student` SET `name` = 'Qin Mingyi' WHERE `student`.`id` = 14;)";
$num = $ pdo->exec($sql);
$insertId = $pdo->lastInsertId();
if($num > 0){
print 'Successfully added'.$num. 'Record, the latest added record ID is'.$insertId;
}
}catch (PDOException $e){
die('Operation failed'.$e->getMessage());
}include 'pdo_conf.php';
$dsn = "{$dbType}:host={$host};dbName={$userName}";
try{
$pdo = new PDO($dsn,$userName,$password);
// echo '<h3>Connection successful</h3>';
$sql = "UPDATE `student` SET `name` = 'Qin Mingyi' WHERE `student`.`id` = 14;)";
$num = $pdo->exec($sql);
$insertId = $pdo->lastInsertId() ;
if($num > 0){
print ''.$num.' records were added successfully, the latest added record ID is '.$insertId;
}
}catch ( PDOException $e){
die('Operation failed'.$e->getMessage());
}