Jump to content

PHP news numbered link pages


-Karl-

Recommended Posts

$con = mysql_connect("localhost","****","*****");

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("*****", $con);

   
   // second query for that id
   $query = "SELECT `title`,`news`,`postedby`,`datetime` FROM `news` WHERE `id`=`id` ORDER BY id DESC";
   $run = mysql_query($query);
   if($run){
      while($arr = mysql_fetch_assoc($run)){
         echo <<<HTML
<div><b><font size="2" color="#FFFFFF">{$arr['title']}</font></b><br/>

<div><font size="2" color="#FFFFFF">{$arr['news']}</font></div>

<div><font size="1" color="#FFFFFF"><div>Posted by</font> <font size="1" color="#3d75a7">{$arr['postedby']}</font> <font size="1" color="#FFFFFF">on</font><font size="1" color="#3d75a7">
HTML;
echo date('d/m/Y \a\t H:i \G\M\T',strtotime($arr[datetime]));

 

Okay, I have my code (see above). It's very basic, just lists the items which are found in the specific table. However, I want to be able to change this to have pages, limiting them to 15 news posts a page. But I'm not quite sure how I'd go about doing this as I'm fairly new to MySQL.

 

So what I want is [1] [2] [3], each would link to a different page of news, depending on the LIMIT from the database.

 

If someone could help me, or show me a tutorial it would be greatly appreciated.

 

Thanks

~Karl

Link to comment
https://forums.phpfreaks.com/topic/195808-php-news-numbered-link-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.