Jump to content

Recommended Posts

Hello all,

 

Right, I have the script that pulls out my bulletins title and author from the db.

I can limit that to whatever i want, say 8.

 

Hopefully, the database will be populated with loads of bulletins, id like to be able to limit the results to 8 per page and have a 'next page' text link that will pull out the next 9-17 results. If you know what I mean?

 

Any help would be great.

 

Here is my code so far!

 

<?php
	 //format a spacer for further down in the page, this is a local variable
				 $spacer = "    -    ";
                    
                 //get the bulletin information from the table
                     
$query = mysql_query("SELECT * FROM bulletin WHERE timeposted ORDER BY timeposted ASC LIMIT 6");
                  	if ($row = mysql_fetch_array($query)) {
						do {
							$timeposted = date("d F Y", strtotime($row["timeposted"]));
							$source 						= $row["source"];
							$message_after_match		 	= $row["message_after_match"];
							$messageid				 		= $row["messageid"];

							 $userquery = mysql_query("SELECT username FROM users WHERE source='$source'");
							 $user = mysql_result($userquery, 0, "username"); 

							//this section prints out the variables needed on the page
							print "<tr>
					<td><div align='left'>Written by$spacer$user</div></td>
									<td><div align='left'>".$timeposted."</div></td>								
		<td><div align='left'><a href='bulletin.php?bulletin=$messageid'>Read</a></div></td>
									</tr><P>";

						} while ($row = mysql_fetch_array($query));   


				}


                  	else {

					//this is printed if nothing is found in the table

                  		print "<tr>
                  					<td></td>
                  					<td>No bulletin found!!!</td>
                  				</tr>";
                  	}
                  

			  
                  	?>

 

Thanks in advance

 

Link to comment
https://forums.phpfreaks.com/topic/52717-solved-next-page/
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.