how do i provide next and previous link in this php script
Posted: Fri Sep 06, 2002 3:29 am
Code: Select all
<?php
$db= mysql_connect("localhost","shadows","qwerty")or die("Error connecting to the Mysql Server");
mysql_select_db("articles",$db);
$id=$HTTP_GET_VARSї"id"];
$title=$HTTP_POST_VARSї"title"];
$info=$HTTP_POST_VARSї"info"];
$body=$HTTP_POST_VARSї"body"];
$query="SELECT * FROM artikle";
$result=mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result)== 0){
echo "<b>No articles found in the database</b>";
}
elseif(!isset($id)){
echo "<table width="75%" border="0" cellspacing="0" cellpadding="0" align="center">";
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
echo "<tr><td bgcolor="#0099CC" align="left" width="51%">";
echo"<b><font color="#993300">&nbsp;<a href="index.php?id=".$rowї'id']."">".$rowї'title']."</a></font></b></td>";
echo "<td bgcolor="#0099CC" align="center" width="49%"> ";
echo "<font color="#993300">By:-&nbsp;&nbsp;".$rowї'author']."</font></td></tr><tr>";
echo "<td height="62" valign="top" colspan="2" bgcolor="#808080">";
echo "<p><font color="#FFFFFF">&nbsp;&nbsp;".$rowї'info']."</font></p>";
echo "</td></tr><tr><td height="9" colspan="2"></td></tr>";
}
echo "</table>";
}
elseif(isset($id)){
$query ="SELECT * FROM artikle WHERE id=$id";
$result= mysql_query($query) or die(mysql_error());
$row=mysql_fetch_row($result,MYSQL_ASSOC);
echo "<table width="75%" border="0" cellspacing="0" cellpadding="0" height="379" align="center">";
echo "<tr bgcolor="#993300"><td width="2%" height="21">&nbsp;</td>";
echo "<td width="98%" height="21">".$rowї'title']."</td>";
echo "</tr><tr bgcolor="#666666">";
echo "<td width="2%" height="340">&nbsp;</td>";
echo "<td width="98%" height="340" valign="top">".$rowї'body']."</td>";
echo "</tr><tr bgcolor="#999999"><td width="2%"></td><td width="98%"></td></tr></table>";
THIS;
}
?>