Blog Pages

Status
Not open for further replies.

real_in

In Runtime
Messages
277
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 :)
 
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> 
";
	echo $result['pcontent']."
<hr>";
	}


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

$i=0;
$lil=1;

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

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

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


thanks for ur consideration :)
 
Status
Not open for further replies.
Back
Top Bottom