ted_chou12 Posted December 26, 2006 Share Posted December 26, 2006 hi, I am having problem with this, I wish to have my own error message instead of "or die(mysql_error());" because my users dont understand those mysql messages. But it doesnt work if you dont put them there after mysql_query($query);... so is there a way to show my own error message instead of mysql error messages?ThanksTed Quote Link to comment https://forums.phpfreaks.com/topic/31846-solved-does-mysql_queryquery-always-have-to-be-followed-by-or-diemysql_error/ Share on other sites More sharing options...
Psycho Posted December 26, 2006 Share Posted December 26, 2006 You can put whatever you want in the "die" conditional. If you are making user friendly error messages, then you should NEVER use die as the rest of the page will not be loaded. Quote Link to comment https://forums.phpfreaks.com/topic/31846-solved-does-mysql_queryquery-always-have-to-be-followed-by-or-diemysql_error/#findComment-147748 Share on other sites More sharing options...
ted_chou12 Posted December 26, 2006 Author Share Posted December 26, 2006 so print or echo would be better? Quote Link to comment https://forums.phpfreaks.com/topic/31846-solved-does-mysql_queryquery-always-have-to-be-followed-by-or-diemysql_error/#findComment-147749 Share on other sites More sharing options...
btherl Posted December 26, 2006 Share Posted December 26, 2006 If you want more flexibility, you can write it like this:[code=php:0]$result = mysql_query($sql);if ($result === false) { print "The query to fetch widget ids from the database failed! Please try again in a few minutes, or send an email to admin@example.com if problems persist. Thankyou for your patience.\n"; # Do whatever else you want to do.. exit(0);}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31846-solved-does-mysql_queryquery-always-have-to-be-followed-by-or-diemysql_error/#findComment-147763 Share on other sites More sharing options...
ted_chou12 Posted December 26, 2006 Author Share Posted December 26, 2006 oh thanks :D Quote Link to comment https://forums.phpfreaks.com/topic/31846-solved-does-mysql_queryquery-always-have-to-be-followed-by-or-diemysql_error/#findComment-147786 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.