Error message doesn't display on mysql connect failure
if( ! $this->remote_connection_id = @mysql_connect($vars['hostname'], $vars['username'], $vars['password'], TRUE))
{
die('Could not connect: ' . mysql_error());
}
only displays Could not connect:
Try
$mysqli = new mysqli ( $vars ['hostname'], $vars ['username'], $vars ['password'], "test" );
if ($mysqli->connect_errno) {
printf ( "Connect failed: %s\n", $mysqli->connect_error );
}
else
{
echo "Am OK" ;
}
Thanks
:)
Try adding parentheses properly.
Instead of:
if( ! $a = foo())
Use:
if( !($a = foo()))
The reason you get no error is because the connection was successful.
Access denied for user 'rootq'@'localhost' (using password: NO)
Oleksandr IY 2012-04-05 21:15
$vars
is set correctly - Marc B 2012-04-05 21:29
Do you have 2 connections? like this:
$link_lang_db = mysql_connect($conf_lang_db_host, $conf_lang_db_user, $conf_lang_db_password, 1) or die('Could not connect: ' . mysql_error($link_lang_db));
$link_editor_db = mysql_connect($conf_editor_db_host, $conf_editor_db_user, $conf_editor_db_password, 1) or die('Could not connect: ' . mysql_error($link_editor_db));
then try this:
$result = mysql_query($query24f, $link_lang_db) or die("Error: " .mysql_error($link_lang_db));
Hope it helped.