Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to catch query exception in laravel 8

try { 
  $results = DB::connection("example")
    ->select(DB::raw("SELECT * FROM unknown_table"))
    ->first(); 
    // Closures include ->first(), ->get(), ->pluck(), etc.
} catch(IlluminateDatabaseQueryException $ex){ 
  dd($ex->getMessage()); 
  // Note any method of class PDOException can be called on $ex.
}
Comment

PREVIOUS NEXT
Code Example
Php :: get image name and extension laravel 
Php :: phpunit filter 
Php :: php return json 
Php :: encryp with codeigniter 3 
Php :: drupal 7 entity_metadata_wrapper bundle 
Php :: Deprecated Functionality: stripos() 
Php :: php hide decimals if zero 
Php :: different days in carbon laravel between different dates 
Php :: count files in folder php 
Php :: php access json object 
Php :: laravel dynamic page title 
Php :: xendit callback 
Php :: Laravel 8 query builder, Inner Join Clause 
Php :: laravel create project thorugh composer 
Php :: func_get_args with keys 
Php :: laravel download file from public folder 
Php :: wordpress remove quick edit custom post type 
Php :: how to take input in php 
Php :: php current date get 
Php :: php ini ubuntu 
Php :: drupal 8 get field entities 
Php :: take last four digits php 
Php :: php get timezone 
Php :: php check array is not associative 
Php :: PHP Deprecated: Function create_function() 
Php :: htmlspecialchars() expects parameter 1 to be string 
Php :: how to get previous month in php 
Php :: get field acf 
Php :: array should not be empty php 
Php :: php keep only letters and numbers 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =