Hi all, I started building a content management app for a new site and I stumbled into a problem. I'm calling each page from a database (see code below). But, one of the pages I want to call I want to have return a list of news items that the user could click to bring up the detail. I can get this to work if this list page is by itself, but I get errors when attempting to copy the code into the body field of the table. I'm guessing it's freakin' out because I'm attempting to call a recordset (news list) within a recordset (the page itself). For example, using the code below, if I use id 123, it would bring back a single recordset and display it contents -- usually just text. But, id 456 might contain code (in the body field) to generate another recordset to display code. Make sense? How do I do this? Can I do this? Thanks!
Code: Select all
<body>
<div id="wrapper">
<?
require("inc/siteheader.inc");
require("inc/leftnav.inc");
require("inc/conn.inc");
$id=$_GETї'id'];
$query=" SELECT * FROM content WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$date=mysql_result($result,$i,"date");
$title=mysql_result($result,$i,"title");
$body=mysql_result($result,$i,"body");
$title = stripslashes($title);
$body = stripslashes($body);
?>
<div id="content">
<h3><? echo $title; ?></h3>
<p><? echo $date; ?></p>
<p><? echo $body; ?></p>
</div>
<?
++$i;
}
mysql_close();
?>
<?
require("inc/sitefooter.inc");
?>
</div>
</body>
David
feyd | 