Jump to content


Hide Pages in PHP


5 replies to this topic

#1 AFG89

    Young Padawan

  • Members
  • Pip
  • 17 posts
  • Gender:Male
  • Location:Canada

Posted 02 September 2007 - 11:10 AM

Hey

I have developed a new script for my site. i made pages using php and now i want to now to cut them, I mean, this is how it look " Pages: 1 2 3 4 5 6 7 8 9 10 Next". Anyone now how to make them look like this " Pages: 1 2 3 ... 8 9 10 Next".

Here is my php code:

<?
if (isset($_GET["type"])) {
 echo "<div class='border'><div class='m_header'>All  - Displayed by Most Recent</div></div>"; 
}
 ?>
 
 <?
 $conn=mysql_connect($dbhost, $dbuser, $dbpass);
 mysql_select_db($dbname) or die ("Unable to connect to MySQL");
 // print "Connected to MySQL"; </P> <P>
 $qresult = mysql_query("SELECT * FROM t_media WHERE m_type='".$_GET["type"]."' AND m_submapproved='Y'");
 
 $nrResults=mysql_num_rows($qresult);
 
 if (($nrResults%$allLimit)<>0) {
  $pmax=floor($nrResults/$myLimit)+1;
 } else {
  $pmax=floor($nrResults/$myLimit);
 }
 $qresult = mysql_query("SELECT * FROM t_media WHERE m_type='".$_GET["type"]."' AND m_submapproved='Y' ORDER BY m_id DESC LIMIT ".(($_GET["page"]-1)*$myLimit).", $myLimit");

 while ($line = mysql_fetch_assoc($qresult)){
?>

<? include("show.php"); ?>

<? } ?>


<div class='pages'>Page : <?=(($_GET["page"]<$pmax)?"<b><a href=\"/all/".$_GET["type"]."s/page".($_GET["page"]-1)."\" class=\"mediaTitle\">Previous</a>":"")?>
	  <?
		$pid=1;
		while ($pid<=$pmax) { ?>
			 <a href="/all/<?=$_GET["type"]?>s/page<?=$pid?>" class="page"> <?=$pid?></a> 
	   <? 
		$pid++;
	   } ?>
<?=(($_GET["page"]<$pmax)?"<b><a href=\"/all/".$_GET["type"]."s/page".($_GET["page"]+1)."\" class=\"mediaTitle\">Next</a>":"")?> <a href="/all/<?=$_GET["type"]?>s/page<?=$pmax?>" class="page"> Last</a> 
				   
   </div>
Any one know how do it ?

Edited by rc69, 02 September 2007 - 03:58 PM.


#2 _*Creative Insanity_*

  • Guests

Posted 02 September 2007 - 11:16 AM

Do a search on here for pagination. There are plenty of tutorials on P2L about that.

#3 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 02 September 2007 - 02:35 PM

yeah, what CI said. :biggrin:


the basic concept is that you only care to show the first and last 3-4 pages. that's where i would start if you already have the pagination setup

#4 stingerblue

    Young Padawan

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:North of the Border, UK

Posted 02 September 2007 - 09:10 PM

There is just the one tutorial on this: http://www.sampsonvi...PHP_Pagination/

#5 _*Creative Insanity_*

  • Guests

Posted 02 September 2007 - 10:48 PM

These videos? what codec do they use.. I have just about everything and they don't play. No video or sound.
Nothing on his site either to say what it uses.

#6 Braunson

    Young Padawan

  • Members
  • Pip
  • 237 posts
  • Gender:Male
  • Location:Ontario, Canada

Posted 06 September 2007 - 04:52 PM

Their just regular windows media 9 codecs.
Mabe try re-installing your windows media player.

Windows Media Video 9 Screen Coded
Windows Media Audio Voice 9 20 kbps, 22.05 kHz, mono





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users