Dear All
this is my first topic here i need some help with php coding, I have an old script for image gallery that i were able to upgrade on it. I did some change by adding the option of the categories but my issue is when going to the second page ( each page has X amount of images ) and the page splitte to ?page= 2 and like that. but when i add the category id this option didn't work please help.
<?php
// Get Page config Info
$info = @mysql_query("SELECT keywords,description,sitetitle FROM configtable LIMIT 1");
$pageInfo = @mysql_fetch_assoc($info);
$pageDesc = $pageInfo['description'];
$pageKeyw = $pageInfo['keywords'];
$general_title = $pageInfo['sitetitle'];
$rowSen = 21;
$numRow = $rowSen + 1;
//check the page number
if(empty($page) || !is_numeric($page)){
$st = 0;
$page = 0;
}else if(is_numeric($page)){
$st = $page * ($numRow+1);
$st = @mysql_real_escape_string($st);
}
// Get Photos By Category
if(isset($_GET['id'])){
$id = @mysql_real_escape_string($_GET['id']);
$get_all_images = mysql_query("SELECT * FROM photos WHERE photo_country = $id");
$num_images = mysql_num_rows($get_all_images);
$QueryCount = @mysql_query("SELECT count(*) as num FROM photos WHERE photo_country = $id");
$QueryNumbr = @mysql_fetch_assoc($QueryCount);
// Get Country By Id
$countries_set = @mysql_query("SELECT * FROM countries WHERE id = $id LIMIT 1");
$country = mysql_fetch_assoc($countries_set) ;
$countrysnum = @mysql_num_rows($countries_set);
}
else
{
$photos_set = @mysql_query("SELECT * FROM countries ORDER BY id desc");
}
?>
and herer is my gallery
<table width="850px" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><?php
if($num_images>0){
$count = 0;
$num = 0;
$fin = 0;
$num_colm = 3;
while($row = mysql_fetch_assoc($get_all_images)){
if($count < $rowSen){
$fin++;
if($num==$num_colm){
echo "</tr>\n";
echo "<tr>\n";
$num = 0;
}else if($num==0){
echo "<tr>\n";
}
if($lan=='en'){
$download = "Download";
}else{
$download = "Download";
}
$PICnewPath = 'data/photos/'.$row['photo_name'] ;
echo '<td><center><a href="'.$PICnewPath.'" rel="lightbox[roadtrip]"><img style="font-size:15px;" onmouseover="this.style.opacity = \'0.4\';" onmouseout="this.style.opacity = \'1\';" height="150" src="'.$PICnewPath.'" alt="'.$row['photo_title'].'" title="'.$row['photo_title'].' " /></a></center><p><center>' . $row['photo_title'] . '<br />
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> ' . substr(stripslashes(strip_tags($row['photo_dec'])),0,500) . '<a href="picture.php?&id=' . $row['photo_id'] . '"> Read More</a></td>
</tr>
</table> </center></p>
</div></td>';
$num++;
if($fin == $num_images){
if($num!=$num_colm && $fin>$num_colm){
$subtract = $num_colm - $num;
for($i=0;$i<$subtract;$i++){
echo '<td> </td>';
}
}
echo "</tr>\n";
}
}
$count++;
}
}else{
$brak = '<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />';
if($lan=='en'){
echo '<tr><td>There is no images right now'.$brak.'</td></tr>';
}else{
echo '<tr><td>There is no images right now'.$brak.'</td></tr>';
}
}
?></td>
</tr>
</table>
and here is my page splitting code
<?php
$dataNum = $QueryNumbr['num'];
if($dataNum>$numRow){
$numPages = $dataNum/$rowSen;
$numPages = ceil($numPages);
for($i=0;$i<$numPages;$i++){
$pageNum = $i + 1;
if($i==$page){
echo '<b><span class="shift" style="font-size:15px">'.$pageNum.'</span> ';
}else{
echo '<a style="font-size:15px" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&page='.$i.'" class="shift">'.$pageNum.'</a></b> ';
}
}
}
?>
Please help