me102 Posted January 3, 2009 Share Posted January 3, 2009 Hello I have a script thats checks to see if I am able to connect to the database or not. If I am unable to it should display an image called refused and if I am able to connect it should display the accept image. Everything works fine in my script but I cant seem to get ride of my mysql warning saying its unable to connect to the database. Heres my code $connect = mysql_connect($showcart['mysql_host'],$showcart['mysql_username'],$showcart['mysql_password']); if(!$connect){ $tconnect = "<img src=\"images/refuse.png\">"; }else{ $tconnect = "<img src=\"images/accept.png\">"; } I just need the warnings to go away if the script cant connect to the database. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/139349-solved-mysql-warnings/ Share on other sites More sharing options...
xtopolis Posted January 3, 2009 Share Posted January 3, 2009 @mysql_connect Quote Link to comment https://forums.phpfreaks.com/topic/139349-solved-mysql-warnings/#findComment-728867 Share on other sites More sharing options...
me102 Posted January 3, 2009 Author Share Posted January 3, 2009 @mysql_connect Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/139349-solved-mysql-warnings/#findComment-728876 Share on other sites More sharing options...
PFMaBiSmAd Posted January 3, 2009 Share Posted January 3, 2009 Using the @ to suppress errors also prevents those errors from being logged, which prevents a record of problems so you don't know if, when, or why something on your site is failing. The display_errors setting should be set to OFF on a live server so that errors continue to be logged so you have a record of problems so you can find and fix them. Quote Link to comment https://forums.phpfreaks.com/topic/139349-solved-mysql-warnings/#findComment-728880 Share on other sites More sharing options...
xtopolis Posted January 3, 2009 Share Posted January 3, 2009 Oh, I wasn't aware it didn't log them. Learn something new every day. Quote Link to comment https://forums.phpfreaks.com/topic/139349-solved-mysql-warnings/#findComment-728883 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.