Help with viewing blog entrys via archive page..
Posted: Thu Apr 01, 2004 7:48 pm
I've been trying to create an archive page with little luck.. I think I'm going in the right direction but i'm stuck.. The page does what it needs to up until I tell it to get a single blog entry then I get this:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/stephen/public_html/site/blog/archives.php on line 54
So I'm guessing my loop doesn't stop? Line 54 is where I start the loop..
Fatal error: Maximum execution time of 30 seconds exceeded in /home/stephen/public_html/site/blog/archives.php on line 54
So I'm guessing my loop doesn't stop? Line 54 is where I start the loop..
Code: Select all
<?
if(!isset($entry)){
echo'<ul>';
//Get config file
include("/home/stephen/site/inculdes/config.php");
/* Connecting to MySQL*/
$connection = mysql_connect($db_host,$db_user,$db_pass)
or die("Could not connect to mysql. Fix me!?!");
/* Select Database. */
$db = mysql_select_db($database_name,$connection) or die("ERROR: I couldn't select the database requested!");
//Time choices
if ($UStime==we_are_superior) {
//date format
$sql = "SELECT DATE_FORMAT(date, '%M %e, %Y @ %h:%i %p') AS readable_date,topic,entry,ID FROM $tablename order by date desc";
$sql_result = mysql_query($sql, $connection) or die("Query failed. Please contact the site administrator, and bitch at him.");
/*setting up array and defining result values */
while ($row = mysql_fetch_array($sql_result)) {
//defining variables, readable_date is temp field
$date = $row["readable_date"]; //date
$topic = $row["topic"]; //Title of blog entry
$id = $row["ID"]; //ID of blog entry
$post = $row["entry"];
$Post = nl2br($post); //
//HTML for post
$view = ("<table cellspacing='0' cellpadding='0' border='0'>
<tr>
<td width='150' align='left' valign='top' style='padding: 5px'>
<img src='/site/images/bullet.gif' align='left'><i><b>$topic</b></i><br>
<font size='1'><i>$date</i></font>
</td>
<td width='500' bgcolor=000000 align='left' valign='top' style='border-top: solid 1px #516382; border-bottom: solid 1px #516382; border-left: solid 1px #516382; border-right: solid 1px #516382; padding: 5px'>
<img src='/site/images/bullet.gif' align='left'>$Post<br><br><i>--Stephen</i>
</td>
</tr>
</table>");
//Display links
echo '<li><a href="/index.php?id=archives&entry='.$id.'">'.$date.' - '.$topic.'</a></li>';
}
mysql_free_result($sql_result);
mysql_close($connection);
}
echo'</ul>';
}
else
{
for($i=0; i<count($id); $i++)
{
if($entry==$id[$i])
{
echo('$view');
break;
}
}
}
?>