etully wrote:You shouldn't have to. When you use a web browsr to call this file: "domainname/news.php?articleid=170", news.php should be including menu.inc, leftside.inc, rightside.inc, bottom.inc. Right?
You're absolutely right!
And let me say that I finally found somebody that understands my problem!
Here is the code I use to retrieve the articles from the db in my news.php page:
<html>
<body>
<?php
$db = mysql_connect("localhost", "XXXXXXX", "XXXXXXXX") or die(mysql_error());
mysql_select_db("XXXXXXX", $db) or die(mysql_error());
if(!isset($GET['articleid']) || empty($GET['articleid']))
{
$get = mysql_query("SELECT * FROM XXXXXXXXX ") or die(mysql_error());
while($row = mysql_fetch_array($get))
{
// Declare your variables in here
$id = $row['ID'];
$title = $row['title'];
$date = $row['date'];
$article = $row['article'];
echo("<a href='http://www.mydomain.com./about/news.php?articleid=$id'>$id</a><br>");
}
}
else
{
$get = mysql_query("SELECT * FROM article_news WHERE ID='".$_GET['articleid']."' LIMIT 1");
$info = mysql_fetch_array($get);
// Display a link to the article index 🙂
echo '<a href="'.$_SERVER['PHP_SELF'].'"></a>';
echo $info['article'];
}
?>
</body>
</html>
The above script pulls out the articles with the articlle id, no problem at all.
But when I go to add the includes, it gives me a parse error like this:
Parse error: parse error, unexpected '<' in /home/XXXXXX/public_html/about/menu.inc on line 22
etully wrote:The data in your database should just be the body of the article, not the menu, left, right, and bottom. That's why you have include files... so that when you modify them, the changes appear when news.php builds the article page.
Again you're right.
etully wrote:If, for some reason, you are storing the entire page in the database (rather than just the body of the article), then... ummm... I can't think of any easy way to update those pages in your database. If you are doing it that way, it's probably easier to change how you store articles than it is to try to update the menu, left, right, and bottom data in the database for each article.
That's how I did it with the entire pages. No biggie i can change it. But when I store just the body of the article, and I pull everything else out, all I get is the article, widespread from side to side, the length of the screen, without the includes, (top, bottom, left and right). I wanna change the way I store these articles, it will definitly be much easier to edit from the includes, instead of one by one!
I appreciate your help and I thank you very much.
If you wish to help me resolve this I would really appreciate it, and I wanna thank you once again