Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php pdo setting error modes

// there are three supported ways of handing errors 
// 1. PDO::ERROR_SILENT ->PDO sets an error code
// 2. ERRMODE_WARNING   -> set an error code and warning message
// 3. PDO::ERRMODE_EXCEPTION -> error  and exception
// To set the error handling strategy, you can pass an associative array 

// there are two ways to set the error modes 
//to the PDO constructor like this:
$pdo = new PDO($dsn, $user, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);

//Or you can use the setAttribute() method of the PDO instance:
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel convert querybuilder to string 
Php :: laravel model::query 
Php :: php declare array 
Php :: Laravel jwt check token sent by request is valid 
Php :: get users other than specific role laravel role spatie 
Php :: php slice array in half 
Php :: get node url from id twig 
Php :: php combine 2 arrays keep duplicates 
Php :: Hide Categories - Woocommerce Product Page 
Php :: html in php 
Php :: laravel use config 
Php :: vs code php tag shortcut 
Php :: php script read source code web 
Php :: laravel scheduler on shared hosting 
Php :: PHP trim — Strip whitespace (or other characters) from the beginning and end of a string 
Php :: two column date compare in php 
Php :: laravel santum 
Php :: how to create constant in php 
Php :: laravel copy image with new name 
Php :: object of class stdclass could not be converted to string php laravel 
Php :: new static laravel 
Php :: laravel belongs to 
Php :: wordpress get post date custom format 
Php :: math functions and predefined constants php 
Php :: number data type in laravel migration 
Php :: cron job every 5 minutes wordpress 
Php :: php value in array 
Php :: how to create cookie in laravel 
Php :: PHP rtrim — Strip whitespace (or other characters) from the end of a string 
Php :: laravel api 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =