FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Suppressing mysql error





kv
I am testing my website on my local machine. It is still in development stage and I am using php/mysql. If there is a mysql connection error, I am checking for the connection variable and displaying a proper error message. But even before it displays my error message, it displays an error message on browser thrown by mysql (MySQL Connection Failed: Access denied for user).

Can I suppress this message and display only my message?
Atomo64
add an @ on the connection code.... like this:
Code:

<?php
$link=@mysql_connect(blablabla);
?>

with that you are going to hide any message, and you can use the @ for everything, even for something like
Code:

<?php

if(@$_GET["page"]=="some_page")
{}
?>

even without checking if the $_GET["page"] variable is set... but I recommend you to only use the @ when you can't hide the message.
kv
Thanks. That helped. I also discovered that setting

error_reporting(0);

will suppress all the errors (which might be bad also. May take long time to debug.)
Related topics
Mysql error!
MySQL error 1604
[solved] Weird mysql error
[mySQL] Error I cannot Debug
MySql error: Column count doesn't match value count at row 1
Mysql Error
MySQL error
Error connecting to mysql ; please help
Mysql error: Warning: mysql_num_rows():
mysql error
MySQL error
Urgent! MySQL error!
MYSQL Ajax im Installation Error
Mysql ERROR
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.