steviez Posted June 30, 2008 Share Posted June 30, 2008 Hi, I want to creat a class/function so that i can show errors like this: <?php echo $error->showError['My error here']; ?> How would i do it? Quote Link to comment Share on other sites More sharing options...
craygo Posted June 30, 2008 Share Posted June 30, 2008 Not sure if you need an entire class for just errors. Usually the errors are in an existing class. For instance if you have a class for mysql functions, then you would put the error checking right in the class. but to answer your question error.class.php <?php class error_check{ function showError($msg){ $message = $msg; return $message; } } ?> then include file on page <?php include ('error.class.php'); $error = new error_check(); echo $error->showError("my error here"); ?> Ray Quote Link to comment 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.