Reply
paging MYSQL results?
Old 04-15-2008, 06:44 PM paging MYSQL results?
Sneakyheathen's Avatar
Ultra Talker

Posts: 283
Name: Corey Freeman
Mostly, I don't understand the "SELECT COUNT * AS *" stuff for mysql. This is what I have for recognizing older post pages:

Code:
if(isset($_GET['page'])){
$id = $_GET['page'];
$query  = " SELECT page_title, page_text FROM page LIMIT 5,$id " . " ORDER BY id DESC "; 
}
and this is what i have to display pages on the front page

Code:
else{

//get the information...
$query  = " SELECT id, title, text, date FROM blogpost " . " ORDER BY date DESC " .
"LIMIT 5";
$result = mysql_query($query) or die('Error, query failed');

//DISPLAY THE POSTS with the newest one on top, hopefully.

while($row = mysql_fetch_array($result)) {
echo "<div id='post' class='post'><div id='title'<b><a href='index.php?id={$row['id']}'>{$row['title']}</a></b> | {$row['date']} </div><br>" .
         "{$row['text']} <br><br>" .
     "</div>";
}
I read php-mysql-tutorial.com, but I don't understand the code for paging at all.
Sneakyheathen is offline
Reply With Quote
View Public Profile Visit Sneakyheathen's homepage!
 
When You Register, These Ads Go Away!
     
Old 04-15-2008, 08:18 PM Re: paging MYSQL results?
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 952
Name: Jeremy Miller
Location: Reno, NV
Let me recommend my code posted at http://www.webmaster-talk.com/php-fo...l-results.html . It uses MySQLi instead of the MySQL interface, but it should be a good guide to get you on your way.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to paging MYSQL results?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11131 seconds with 13 queries