[Blog Pages] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



Blog Pages

(Click here to view the original thread with full colors/images)



Posted by: real_in

hey guyss, whatzz up..

yeah i m back again with a query, i jus want to know while i want to display the enteries from my blog, how to i scroll thru pages..

I mean i display the latest five on first page, then do i need to create manually all other pages??

or there is some technique with is followed ???

Thanks a lot :)



Posted by: Stormdev

Here is a technique using PHP with MySQL. I am sure that if your using some other language you can port the code to suit your needs.

[url]http://www.devshed.com/c/a/PHP/Paginating-MySQL-Data-with-PHP/[/url]

Hope this helped.



Posted by: real_in

hey lads, i got this technique and is working like a charm on my website..

you guys can also follow this technique :)

here is a snippet..

[code]

if(!isset($start))
{
$start=0;
}

$eu=$start-0;
$limit=2;
$this1=$eu + $limit;
$back=$eu - $limit;
$next=$eu + $limit;


$sql="Select * from db_posts";

$result=mysql_query($sql);

$number=mysql_num_rows($result);

$query="select * from db_posts order by id desc limit $eu,$limit";

$res=mysql_query($query);



while($result=mysql_fetch_array($res))
{
echo "<b>".$result['ptitle']."</b>";
echo "<font size=2>,by ".$result['uname']."</font> <br>";
echo $result['pcontent']."<br><hr>";
}


if($back >=0)
{
print "<a href='$page_name?start=$back'><font face='Verdana' size='2'>PREV</font></a>";
}

$i=0;
$lil=1;

for($i=0;$i < $number;$i=$i+$limit)
{
if($i != $eu)
{
echo " <a href='$page_name?start=$i'><font face='Verdana' size='2'>$lil</font></a> ";
}
else
{
echo "<font face='Verdana' size='4' color=red>$lil</font>";
}

$lil=$lil+1;
}

if($this1<$number)
{
echo "<a href='$page_name?start=$next'>NEXT</a>";
}
else
{
echo"<font color=gray> No More Pages</font>";
}

[/code]

I am a new coder so you guys can very well judge mistakes, if any :)


thanks for ur consideration :)





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon