<?php // Connects to your Database
mysql_connect("localhost", "techker_techker", "techker") or die(mysql_error()) ;
mysql_select_db("techker_softcore") or die(mysql_error()) ;
$QQQ = mysql_query("SELECT * FROM softcore WHERE type='sketch'");
if (!$QQQ) die(mysql_error());
// Get the total number of rows
$total_items = mysql_num_rows($QQQ);
// Get the page limit & page
$limit = $_GET['limit'];
$page = $_GET['page'];
// Do default setting
if((!$limit) || (is_numeric($limit) == false) || ($limit < 1) || ($limit > 5)) {
$limit = 50; //default
}
// Do default setting
if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) {
$page = 1; //default
}
// Calculate the number to page to display
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit);
$QQQ1 = mysql_query("SELECT * FROM softcore WHERE type='sketch'");
if(!$QQQ1) die(mysql_error());
$err = mysql_num_rows($QQQ1);
//if($err == 0) die("No matches met your criteria.");
// Let user decide how many result to show in each page
// echo "Results per page: ";
//echo "<a href='list_store.php?limit=2&page=1'>2</a> |
//<a href='list_store.php?limit=5&page=1'>5</a> |
//<a href='list_store.php?limit=10&page=1'>10</a>";
//Count Message
$count = 1;
//to loop the results into the table rows code goes here
//while($FFF = mysql_fetch_assoc($QQQ1)) {
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> SOFTCORE</title>
<style type="text/css">
</style></head>
<body>
<div align="left"><? echo '<table><tr>';
$cnt = 0;
while ($row = mysql_fetch_assoc($QQQ1)) {
echo '<td><a href="/admin/pic_view.php?id='. $row['id'] .'" target="_blank" >
<img src="/admin/art/'. $row['thumb'] .'" border="0" alt="" />
</a></td>'; // output the img tag
$cnt++; // increase count, as we have added a pic now
if (($cnt % 8) == 0) {
// if $cnt modulus 4 equals 0, we have added 4 pictures,
// and makes a new line/row
echo '</tr><tr>'; // echo end of row
for ($cell = 0; $cell < ($cnt % 8); $cell++) {
echo '<td> </td>';
}
// end the table
echo '</tr></table>';
}
}?>
</div>
<div align="left">
<?php
$prev_page = $page - 1;
if($prev_page >= 1) {
echo(" <a href=pic_galleryS.php?limit=$limit&page=$prev_page><b>Prev</b></a>");
}
for($i = 1; $i <= $total_pages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"pic_galleryS.php?limit=$limit&page=$i\">$i</a> ");
}
}
$next_page = $page + 1;
if($next_page <= $total_pages) {
echo("</b><a href=pic_galleryS.php?limit=$limit&page=$next_page><b>Next</b></a> ");
}
//dbDisconnect($conn2);
?>
</div>
</td>
</tr>
</table>
</p>
</div>
</body>
</html>