otuatail Posted August 25, 2007 Share Posted August 25, 2007 I have a very unreliable website host provider. sometimes I get an error on my ewebpage saying Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'mysql10.streamline.net' (4) in /home/fhlinux190/d/des-otoole.co.uk/user/htdocs/functions.inc on line 33 Is there anyway I can supress this message and if possible replace it with something more user frendly. Desmond. Quote Link to comment https://forums.phpfreaks.com/topic/66623-cant-connect-to-mysql-server-on/ Share on other sites More sharing options...
chocopi Posted August 25, 2007 Share Posted August 25, 2007 It would be quite silly to supress this error seeing as it is telling you that you are not connecting to the database. You might want to check your connection code. However if you really want to supress it then just put a @ in front mysql_connect becomes @mysql_connect Hope that helps ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/66623-cant-connect-to-mysql-server-on/#findComment-333833 Share on other sites More sharing options...
AndyB Posted August 25, 2007 Share Posted August 25, 2007 or: $result = mysql_query($query) or die("Time to get a reliable host provider"); Quote Link to comment https://forums.phpfreaks.com/topic/66623-cant-connect-to-mysql-server-on/#findComment-333848 Share on other sites More sharing options...
Fadion Posted August 25, 2007 Share Posted August 25, 2007 If the hosting company is unreliable then change it. Surpressing error messages maybe a good way to prevent errors shown on screen (probably to attackers) but not for healing such errors: $connect = @mysql_connect(...) or die("There was an error connecting to the database"); Quote Link to comment https://forums.phpfreaks.com/topic/66623-cant-connect-to-mysql-server-on/#findComment-333856 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.