An include within an include
Posted: Fri Feb 23, 2007 8:24 pm
I am new to php and have just designed a website which works on my local server, but brings up an error, once uploaded to a remote hosting service. Upon speaking with them, they say there must be something wrong with my code, and will only fix it if I come up with bags of dosh.
I have upgraded to the latest versions of php, mysql and Apache, hoping to bring my local server into synch with theirs, but whilst throwing up some changes to the appearance of the site, it has not resolved this issue. So what can be done to make my local server replicate the errors the remote server is bringing up, as debugging errors from a remote server is a pain? As I said, I am new to this, so please forgive if I am missing the obvious.
Upon some testing, it appears that the error is caused by using an include within an include. The following script is itself an include file:
This brings up the 'Show all articles file', but when submitted brings up the following error
I have upgraded to the latest versions of php, mysql and Apache, hoping to bring my local server into synch with theirs, but whilst throwing up some changes to the appearance of the site, it has not resolved this issue. So what can be done to make my local server replicate the errors the remote server is bringing up, as debugging errors from a remote server is a pain? As I said, I am new to this, so please forgive if I am missing the obvious.
Upon some testing, it appears that the error is caused by using an include within an include. The following script is itself an include file:
Code: Select all
<?
if(isset($_POST['Show_All_Articles']))
{
include ("RightColumnListingsArticles.php");
}
else if(isset($_POST['Show_All_Recommendations']))
This brings up the page
{
include ("RightColumnListingsRecommendations.php");
}
else {
/*List Articles*/
$CategoriesID= $_POST['CategoriesID'];
$query2 = "SELECT categories FROM categories WHERE categoriesID=$cc";
$result2=mysql_query($query2) or die(mysql_error());
while ($record=mysql_fetch_array($result2)) {
$category=$record['categories'];
}
echo "<h3>Articles</h3>";
$query = "SELECT title, description, website, articleshelptipsID, priority
FROM articleshelptips WHERE CategoryID=$cc
ORDER by priority";
$result=mysql_query($query) or die(mysql_error());
/*List a limited number of rows*/
$num_rows=mysql_num_rows($result);
for ($i = 0; $i <= 3; $i++)
{
$row=mysql_fetch_assoc($result);
/*echo '<a href=http://'.$row["website"].' target="_blank">'.$row['title'].'</a>';*/
echo ("<a href=http://".$row['website'].' target="_blank">'.$row["title"]."</a>");
echo "</br></br>";
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="submit" name="Show_All_Articles" src="../Graphics/buttonrightarrow.gif" value="More" />
</form>
<?
/*List Recommendations*/
echo "<h3>Recommendations</h3>";
$query2 = "SELECT categories FROM categories WHERE categoriesID=$cc";
$result2=mysql_query($query2) or die(mysql_error());
while ($record=mysql_fetch_array($result2)) {
$category=$record['categories'];
}
$query = "SELECT Title, Recommendation, Name, ReadersCommentsID, CompanyName, DateCreated, Approved
FROM readerscomments WHERE CategoryID=$cc AND Approved='Yes'
ORDER by DateCreated DESC";
$result=mysql_query($query) or die(mysql_error());
/*List a limited number of rows*/
$num_rows=mysql_num_rows($result);
for ($i = 0; $i <= 3; $i++)
{
$row=mysql_fetch_assoc($result);
echo '<font color="green">'.$row['Title'].'</font>';
echo "</br></br>";
}
if ($num_rows == 0){echo "There are no recommendations, so far, for this cateogory. Why not write one? Simply choose 'recommend' from the menu panel above and complete.";}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="submit" value="More" name="Show_All_Recommendations"><br />
</form>
<? } ?>Code: Select all
Warning: Failed opening 'RightColumnListingsArticles.php' for inclusion (include_path='') in /home/.sites/120/site35/web/Templates/InitialRightColumnListing.php on line 7