I downloaded a PHP script that converts pages to a printable format and this is how you use it:
You add <!-- startprint--> to where you want to start the convert and <!-- stopprint--> to where you want it to stop. Simple right?
Now I use this code to output articles from a database:
<?php
if (isset($id) && is_numeric($id))
{
$display_news = mysql_query("SELECT html FROM news WHERE id=$id")
or die ("MySQL Error");
if (mysql_num_rows($display_news) > 0)
{
while ($row = mysql_fetch_array($display_news))
{
$news = $row["html"];
echo $news;
}
}
else
{
echo("<P CLASS=\"bodytext\" ALIGN=\"CENTER\">OOX ERROR: Bad Link<BR>
Please <A HREF=\"javascript:history.go(-1);\" CLASS=\"bodynav\">click here</A>
to go back to the previous page.</P>");
}
}
else
{
echo("<P CLASS=\"bodytext\" ALIGN=\"CENTER\">Error: No news article was selected!<BR>
Please <A HREF=\"javascript:history.go(-1);\" CLASS=\"bodynav\">click here</A>
to go back to the previous page.</P>");
}
?>
If you look at the first IF statment, it outputs WHILE, and for the while, the ECHO outputs a row. How can I add <!--startprint--><!-- stopprint--> to whatever is output? I tried changing echo to this: echo ("<!-- startprint-->$news<!-- stopprint-->"); but now luck. Thanks for any help.