I have a link that is being parsed on my headline news page that I want linked to a specific ID in a file called newsfull.php.
The link on the headline news page looks like this:
i.e. newsfull.php?id=15
How do I capture the ID number on newsfull.php (file below) and display its $id,$title,$date,$poster,$mail,$newsfull values? I'm currently getting a parse error with the database statements.
Thanks
<?
include("header.inc");
require("admin/news_config.php");
if(isset($id)){
$server = mysql_connect($host,$user,$pass);
mysql_select_db($db,$server);
$sql = "SELECT *, FROM news WHERE id = $id ORDER BY date DESC limit $offset,$limit";
$result = mysql_query($sql);
$numrows = mysql_result($result, 0, 0);
while (list($id,$title,$date,$poster,$mail,$newsfull) = mysql_fetch_row($result)) {
$d = explode("-",$date);
$day = $d[2];
$month = $d[1];
$year = $d[0];
$hour = $d[3];
$min = $d[4];
//############\\
// dateformat:\\
$thedate = "$month/$day/$year - $hour:$min";
//############\\
// NEWS FORMAT
$print = "
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">
<tr>
<td width=\"100%\" bgcolor=\"#EEEEEE\">
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><b>$title</b></td>
<td>
<p align=\"right\">$thedate</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=\"100%\">$newsfull</td>
</tr>
</table>\n<br>\n
";
// END NEWS FORMAT
echo $print;
}
}
// NEXT - PREVIOUS LINKS \
echo"<center>Pages: ";
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
if($pages > $limit){
echo"<i>old news</i><br>";
}
}
if ($offset != 0) {
$prevoffset=$offset-$limit;
echo "<a class=i href=\"$PHP_SELF?offset=$prevoffset\"><<</a> \n";
}
if ( $pages != 1 ) {
for ($i=1;$i<=$pages;$i++) {
$newoffset=$limit*($i-1);
if ( ((($offset)/$limit)==($i-1)) ) {
echo "<font class=i>$i</font> | \n";
} else {
echo "<a class=i href=\"$PHP_SELF?offset=$newoffset\">$i</a> | \n";
}
}
}
if (!((($offset)/$limit)+1==$pages) && $pages!=1) {
$newoffset=$offset+$limit;
echo "<a class=i href=\"$PHP_SELF?offset=$newoffset\">>></a><p>\n";
}
echo"</center>";
?>
<?php include("footer.inc"); ?>