son Posted October 29, 2009 Share Posted October 29, 2009 I run a query and as I will put it live shortly want only to output a customer-friendly message with all the content below that there normally is. 'mysql_query o trigger_error will show error message, so this is a no no. Alternatively 'mysql_query or die' won't display the bottom content. What is best to do?Son Link to comment Share on other sites More sharing options...
Synook Posted October 29, 2009 Share Posted October 29, 2009 The resource contained in the result variable will resolve to false if the query fails, so you just have to check that. $result = mysql_query($some_query);if ($result) { do_something();} else { echo "Oh no, we seem to be having a problem.";}continue_with_rest_of_page(); Link to comment Share on other sites More sharing options...
son Posted October 29, 2009 Author Share Posted October 29, 2009 The resource contained in the result variable will resolve to false if the query fails, so you just have to check that.$result = mysql_query($some_query);if ($result) { do_something();} else { echo "Oh no, we seem to be having a problem.";}continue_with_rest_of_page(); Great! This is working well;-)Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.