I have a script that runs on two servers - one with SQL, and one without.
I have coded it so that it doesn't matter on which server it runs, but when I try to connect (to determine which strategy to follow) with:
Expand|Select|Wrap|Line Numbers
- function connect_to_sql_ok() {
- $conn = @mysql_connect($this->mysql_host, $this->mysql_user, $this->mysql_pass) or die('<hr />MySQL Error: ' .mysql_error(). '<hr />');
- if ($conn != false) {
- $rs = mysql_select_db($this->mysql_db, $conn);
- }
- return $conn;
- }
This is on the server without MySQL. The same code with access to MySQL runs just fine.
I don't want the error getting printed out - I just want the routine to quietly return FALSE, so that I can get on with the other strategy.
I have set as follows:
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
I thought that @ would suppress errors from a function, but it seems not..
Does anyone have any idea?
Thanks..