That is i write in oops it show mysql error message, that i don't want, i wan't only custom MSG.
class Myfunction{
private $DBHOST = 'localhost';
private $DBUSER = 'rot';
private $DBPASS = '';
private $DBNAME = 'database';
public $conn;
public function __construct(){
try{
$this->conn = mysqli_connect($this->DBHOST, $this->DBUSER, $this->DBPASS, $this->DBNAME);
if(!$this->conn){
throw new Exception('Connection was Not established');
}
}
catch(Exception $e) {
echo 'Message: ' .$e->getMessage();
}
}
}
OutPut :-
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'rot'@'localhost' (using password: NO) in C:\xampp\htdocs\CRUD-PHP\config\CUFunction.php on line 13
Message: Connection was Not Extablish
Now Question is How to remove " warning " MSG??, I want to only my custom MSG
One Possible Solution found however, i think it is not appropriate
For Example :
$this->conn = @mysqli_connect($this->DBHOST, $this->DBUSER, $this->DBPASS, $this->DBNAME);