0

Hi friends

In one of my project I displayed data from data base in page wise order ( ie 10 data of a thread in to one page , just like a forum )

I just want to give a link at the first listing page which showing link to last post of a content. ie like this

Thread Name | Post By | Last Post | Time
------------------------------------------------------------
Name | Name | (link ) | Time
------------------------------------------------------------------

On clicking on that link that will leads to last post of that thread . I found in forums this type of link as follows

www.site.com/thread.php?id=124#1245

Guys plz help me how to query from this thread

Thanks in advance
Rajeesh

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by tomato.pgn
0
<?php
$page=1;
$nor=5;
$a=1;
if(isset($_GET['page']))
{
}
else
{
$_GET['page']=1;
}
echo $_GET['page'];
$con=mysql_connect("localhost","root","")
or die ("error");
$db=mysql_select_db("check",$con)
or die("database not found");
$result=mysql_query("SELECT * FROM comment")
or die ("query error");
echo "<table border='1'><tr><th>name</th><th>Comment</th></tr>";
$r=mysql_num_rows($result);
echo $r."<br/>";
$p=ceil($r/$nor);
//echo $p;
while($rows=mysql_fetch_array($result))
{
if($a>($_GET['page']-1)*$nor)
{
echo "<tr><td>".$rows['user']."</td><td>".$rows['comment']."</td></tr>";
}
$a=$a+1;
}
echo "</table>";
for($i=1;$i<=$p;$i++)
{
if($i==$_GET['page'])
{
echo $i;
}
else
{
echo "<a href='check.php?page=".$i."'>".$i."</a>";
}
}
 
?>

Check out this code..Hope this is useful...if u want to make it more advanced let me know...i will do it in an hour.....
Hope it is useful...
IF UR PROBLEM IS SOLVED MARKED THE THREAD AS READ....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.