Code: Select all
<?php include('include/header.php');?>
<?php $gallery_id = $_GET['gallery_view'];
$album = $_GET['album'];?>
<span><a href="default.php"><img src="img/logo.png" /></a></span>
</div>
<ul>
<li ><a href="default.php">home</a></li>
<li><a href="career.php">career</a></li>
<li><a href="realestate.php">realestate</a></li>
<li><a href="shopping.php">shopping</a></li>
<li><a href="image.php">image</a></li>
<li><a href="about.php">about us</a></li>
<li><a href="contact.php">contact us</a></li>
</ul>
<div id="login">
<?php
if (isset($_SESSION['user'])){
echo "Welcome " . $_SESSION['user'] . " | <a href=\"logout.php\">logout </a>";
}else{
echo"
<a href=\"register.php\">register</a>
| <a href=\"login.php\">login </a>
";
}
?>
</div>
</div>
</div>
<hr class="hide" />
<div id="main-outer-wrap">
<div id="main-wrap">
<div id="content">
<?php
/// max per page
$per_page = 1;
// start varable
$start = $_GET['start'];
///record count
$record_count = mysql_num_rows(mysql_query("SELECT * FROM gallery WHERE album_id = '$album'"));
//max page
$max_page = $record_count/$per_page; /// this may contain decimal place
if(!$start)
$start = 0;
/////////////////////////////////////////////////////////
////////////////////////////////////////////////
$gallery = mysql_query("SELECT * FROM gallery WHERE album_id = '$album' AND id = '$gallery_id' LIMIT $start , $per_page");
while( $gallery_row = mysql_fetch_assoc($gallery))
{
echo "<h1 class='address'>" .$gallery_row['description']."</h1>";
echo "</p>";
echo"<p class='pagination'>";
echo "<img src='gallery/$album/".$gallery_row['img']."' width='500px' height='350px'/><br/>";
echo "</p>";
echo"<p class='next_prev'>";
// setup next and prev page
$perv = $start - $per_page;
$next = $start + $per_page;
/// show prev button
if(!($start<=0)){
echo " <a href='gallery_view.php?album=$album&gallery_view=$gallery_id&start=$perv'>prev</a> ";
}
// show next button
if(!($start >= $record_count - $per_page)){
echo " <a href='gallery_view.php?album=$album&gallery_view=$gallery_id&start=$next'>next</a> ";
}
echo "</p>";
}
?>
</div>
<hr class="hide" />
<div id="sidebar">
<p> </p>
</div>
<p> </p>
</div>
</div>
<?php include('include/footer.php');?>