A
Anonymous
Guest
Hello,
I have an events calendar on my home page and I am trying to include a "nice" error message instead of the stuff that php puts out.
I have an include that is set up like this
Then in my page I have the following
and the include to display the info from the db
When I change the host name of the mysql server it supresses the php errors and displays the error that I specified in die()
When I load the home page instead of the error showing up inside the div that I want it to I only get a blank page with the error text.
I need the error to show up inside the div instead of not rendering the whole page.
I know the code could be made more efficient, Ill work on that later as my skills increase.
Any suggestions would be great.
I have an events calendar on my home page and I am trying to include a "nice" error message instead of the stuff that php puts out.
I have an include that is set up like this
Code:
<?php
error_reporting(0);
// DB Connect - Spe-Le-Yai Events
DEFINE (DB_USER, "xxxxx");
DEFINE (DB_PASSWORD, "xxxx");
DEFINE (DB_HOST, "xxxxx");
DEFINE (DB_NAME, "xxxxx");
$db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die ('We are experiencing technical difficulties, we will fix this immediately');
mysql_select_db(DB_NAME) or die ('We are experiencing technical difficulties, we will fix this immediately');
?>
Then in my page I have the following
Code:
<?php require ('/path/to/include/src/php/dates2rem.php'); ?>
and the include to display the info from the db
Code:
<div class="dates2rem"><strong>Next Gerneral Lodge Meeting:</strong><br />
<?php // Next General Lodge Meeting
$result = mysql_query("SELECT * FROM events WHERE title = 'gen' AND dbdate >= now() ORDER BY dbdate LIMIT 1", $db);
printf(mysql_result($result,0,date)); ?>
<br />
<br />
<strong>Next Executive Committee Meeting:</strong><br />
<?php // Next Exec Meeting
$result = mysql_query("SELECT * FROM events WHERE title = 'exec' AND dbdate >= now() ORDER BY dbdate LIMIT 1", $db);
printf(mysql_result($result,0,date)); ?>
<br />
<br />
<strong>Next Ordeal:</strong>
<?php // Next Ordeal
$result = mysql_query("SELECT * FROM events WHERE title = 'ordeal' AND dbdate >= now() ORDER BY dbdate LIMIT 1", $db);
printf(mysql_result($result,0,date)); ?>
<br />
<br />
<strong>Next Brotherhood Ceremony:</strong><br />
<?php // Next Brotherhood Ceremony
$result = mysql_query("SELECT * FROM events WHERE title = 'broth' AND dbdate >= now() ORDER BY dbdate LIMIT 1", $db);
printf(mysql_result($result,0,date)); ?>
</div>
When I change the host name of the mysql server it supresses the php errors and displays the error that I specified in die()
When I load the home page instead of the error showing up inside the div that I want it to I only get a blank page with the error text.
I need the error to show up inside the div instead of not rendering the whole page.
I know the code could be made more efficient, Ill work on that later as my skills increase.
Any suggestions would be great.