downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Alias y Funciones de MySQLi obsoletos> <mysqli_warning::next
[edit] Last updated: Fri, 17 May 2013

view this page in

La clase mysqli_sql_exception

(PHP 5)

Introducción

La clase de manejo de excepciones de mysqli.

Sinopsis de la Clase

mysqli_sql_exception extends RuntimeException {
/* Propiedades */
protected $code ;
protected $sqlstate ;
}

Propiedades

message

El mensaje de error.

file

El fichero con el error.

line

La línea con el error.

code

El código causante del error.

sqlstate

El estado sql con el error.



add a note add a note User Contributed Notes mysqli_sql_exception - [1 notes]
up
0
dronebraindeveloper at gmail dot com
4 months ago
Quick note on how to setup and use mysqli_sql_exceptions properly

<?php
define
("MYSQL_CONN_ERROR", "Unable to connect to database.");

// Ensure reporting is setup correctly
mysqli_report(MYSQLI_REPORT_STRICT);

// Connect function for database access
function connect($usr,$pw,$db,$host) {
   try {
     
$mysqli = new mysqli($host,$usr,$pw,$db);
     
$connected = true;
   } catch (
mysqli_sql_exception $e) {
      throw
$e;
   }
}

try {
 
connect('username','password','database','host');
  echo
'Connected to database';
} catch (
Exception $e) {
  echo
$e->errorMessage();
}
?>

 
show source | credits | sitemap | contact | advertising | mirror sites