Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.