...

View Full Version : ?? Puzzled... Page sometimes not loading...



idalatob
01-10-2008, 10:23 AM
I have a suspicion that it is a server problem... But can you guys detect a problem with this code that would cause it to randomly sometimes not load?



<?php
include("this_file.php");
$page_id = intval($_GET['pid']);
if (!$page_id){
$page_id = 1;
}
$page_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `site_pages` WHERE `page_id`='$page_id'"));
$page_name = "www.x.co.za/index.php?pid=" . $page_id;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title><?php echo($page_details['page_title']); ?></title>
<link rel="stylesheet" href="default.css" type="text/css"/>
<link rel="stylesheet" href="drop-down.css" type="text/css"/>
</head>

<body>
<table width="800" align="center" cellspacing="0" cellpadding="0" style="background-color:white;">
<!--include in header-->
<?php include("includes/header.php"); ?>
<!--end of header-->
<tr><td colspan="2" class="c_blue" height="5"></td></tr>
<tr><td colspan="2" height="30" id="gray_bar">
<?php include("includes/subpagelinks.php"); ?>
</td></tr>
<tr><td colspan="2">
<table width="800" align="center" cellspacing="0" cellpadding="0"><tr>
<td width="160" class="c_grey" height="420" valign="top">
<!--Include in links-->
<?php include("includes/links.php"); ?>
</td>
<td width="5" class="c_orange"></td>
<td width="635" id="right_content" valign="top">
<div id="page_header_bar"><?php echo($page_details['page_title']); ?></div>
<div id="content_container">
<?php echo($page_details['page_content']); ?>
</div>
<div style="text-align:right; padding-right:5px; padding-bottom:5px;"><a style="font-size:14px;" href="mailto:blank?Subject=Interesting Website:www.x.co.za&Body=Hi I found this really interesting website <?php echo($page_name); ?>" >Tell a friend</a></div>
</td></tr>
<tr>
<td width="160" class="c_grey"></td>
<td width="5" class="c_orange"></td>
<td class="c_blue" style="text-align:center; color:white;">Contacts: John W Frith CA(SA), PO Box 2440, Port Alfred, 6170<br>
Tel: 046 624 9000, Fax: 086 668 3374, Cell: 083 378 3374, email: <a style="text-decoration:none; color:white; font-weight:bold;" href="mailto:john@yfcwill.co.za">john@yfcwill.co.za</a></td>
</table>
</td></tr>
</table>


</body>
</html>


I didnt write the code... and I know its a bit sloppy. but still what is giving this error....

mlseim
01-10-2008, 02:03 PM
I'm guessing you're getting a PHP error that is stopping the script.

In this part:


<?php
include("this_file.php");
$page_id = intval($_GET['pid']);
if (!$page_id){
$page_id = 1;
}
$page_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `site_pages` WHERE `page_id`='$page_id'"));
$page_name = "www.x.co.za/index.php?pid=" . $page_id;
?>


Use the server PHP error log, and log PHP errors to see what's happening.

Maybe try something like this (thinking that $page_id is null, but it exists) ...
And what if $page_id=0 or $page_id=9999999?
Are there limits to what it can be?



<?php
include("this_file.php");
$page_id = intval($_GET['pid']);
if (strlen($page_id)<1){
$page_id = 1;
}
$page_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `site_pages` WHERE `page_id`='$page_id'"));
$page_name = "www.x.co.za/index.php?pid=" . $page_id;
?>

idalatob
01-11-2008, 06:35 AM
Well even if $page_id is null it would just generate a notice. Of course I told him to use error_reporting(6143); but he obviously removed it at some stage.

Anyway the problem is, the page doesn't generate an error, just sometimes it doesnt load AT ALL, its really weird... just says the page cannot be found...

You can sit at two computers and open the website, it opens on one and not on the other. Then both, then none. But it just seems really random.

Death_oClock
01-12-2008, 04:20 AM
That is most likely a server or internet problem, if no PHP error is output.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum