<?php $per_page = 8; //get start variable $start = $_GET['start']; //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM posts")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data $get = mysql_query("SELECT * FROM posts LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) { // get data $numelink = 'http://localhost/posts/list.php?'.$title.''; $title = $row['title']; $description = $row['description']; $user = $row['user']; $downloads = $row['downloads']; $pict1 = $row['pict1']; $pict2 = $row['pict2']; $date = $row['date']; $rezolution = $row['rezolution']; $views = $row['views']; $rank = $row['rank']; $memberurl = 'http://localhost/user/'.$user.''; echo ' <div id="posts_in"><div id="texture_pic"><img src="',$pict1,'" width="200" height="150" alt="pic1" /></div> <div id="texture_content"><p align="left"> <a href="'.$numelink.'">' ,$title, '</a></p><div id="posts_content_int"> <table width="192" height="76" border="1"> <tr> <td height="16">Downloads:</td> <td width="103">',$downloads,'</td> </tr> <tr> <td height="16">Rank:</td> <td width="103">',$rank,'</td> </tr> <tr> <td width="16" height="16"> </td> <td width="103"> </td> </tr> <tr> <td height="16"> </td> <td height="16"> </td> </tr> <tr> <td height="16">Date-Add:</td> <td height="16">',$date,'</td> </tr> <tr> <td height="16">User:</td> <td height="16"><a href="', $memberurl, '">',$user,'</a></td> </tr> </table> </div><div id="texture_content_int"><table width="192" height="111" border="1"> <tr> <td width="69" height="16">Complete:</td> <td width="107">',$downloads,'</td> </tr> <tr> <td height="16">Rezolution:</td> <td width="107">',$rezolution,'</td> </tr> <tr> <td>Views</td> <td>',$views,'</td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </div> </div> </div> '; } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='../posts/index.php?start=$prev'>Prev</a> "; //show page numbers //set variable for first page $i=1; for ($x=0;$x<$record_count;$x=$x+$per_page) { if ($start!=$x) echo "<a href='../posts/index.php?start=$x'>$i</a> "; else echo " <a href='../posts/index.php?start=$x'>$i</a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) echo "<a href='../posts/index.php?start=$next'>Next</a>"; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)