sc0tt Posted January 28, 2009 Share Posted January 28, 2009 Hello, I made a call to a php script via ajax in my code . The php script tests for connection to a MYSQL database . If connection is successful , it echos "Connection Succeeded", and that correctly shows up in the responseText property. However, if the connection fails , i have echoed "Connection failed" . Now , the strange thing is that if the connection fails, the warning from mysql , which is as below, also gets appended to the text i have echoed. Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host .... Connection failed How, can i prevent the warning from the mysql server from automatically getting appended to the responseText ? Thank You. Link to comment https://forums.phpfreaks.com/topic/142762-solved-mysql-warning-automatically-getting-appended-to-responsetext-property/ Share on other sites More sharing options...
nareshrevoori Posted January 28, 2009 Share Posted January 28, 2009 Put error suppression operator(@) in front of your mysql_connect function. just like this @mysql_connect("HOST","USERNAME","PASSWORD"); so basically what @ operator does is it will suppress the error handling mechanism by PHP. Link to comment https://forums.phpfreaks.com/topic/142762-solved-mysql-warning-automatically-getting-appended-to-responsetext-property/#findComment-748340 Share on other sites More sharing options...
sc0tt Posted January 28, 2009 Author Share Posted January 28, 2009 Thanks a lot naresh..that worked Link to comment https://forums.phpfreaks.com/topic/142762-solved-mysql-warning-automatically-getting-appended-to-responsetext-property/#findComment-748357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.