07/11/2013, 17:17
|
| Colaborador | | Fecha de Ingreso: junio-2013 Ubicación: México
Mensajes: 2.995
Antigüedad: 11 años, 7 meses Puntos: 379 | |
Respuesta: Errores con MySQLi Cita:
Iniciado por keypyhh
Código PHP:
Ver originalprotected function abrirConexion() { try{ $this->conexion = new mysqli('localhost', 'root','root', 'latabla'); if (!$this->conexion) { return false; } else { return true; } } catch (Exception $e){ return false; } }
¿Alguna manera de yo saber el error y retornar el false sin que se detenga la ejecución? Implementando el try.. catch apropiadamente con mysqli_sql_exception: te dejo la liga a la documentación: http://php.net/manual/en/class.mysqli-sql-exception.php
__________________ Saludos About me Laraveles
A class should have only one reason to change. |