Help with php code for image gallery
| From: | Ahmed AL-ZAIDY | Date: | Wed, 01 Aug 2012 14:41:45 +0000 |
| Subject: | Help with php code for image gallery | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-14030@lists.php.net to get a copy of this message | ||
Hello
I need a help with php codes for image gallery i'm using the below codes
and its working fine on linux but on server the option of the next page to
not loading the images from the database just changing the page number and
link
$rowSen = 5;
$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 Topics By Country
if(isset($_GET['id'])){
$id = @mysql_real_escape_string($_GET['id']);
$get_all_images = mysql_query("SELECT * FROM topics WHERE topic_country =
$id ORDER BY id desc LIMIT $st,$numRow");
$num_images = mysql_num_rows($get_all_images);
$QueryCount = @mysql_query("SELECT count(*) as num FROM topics");
$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
{
$topoics_set = @mysql_query("SELECT * FROM countries ORDER BY id desc");
}
===================
<?php
if($num_images>0){
$count = 0;
$num = 0;
$fin = 0;
$num_colm = 5;
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/topics/'.$row['topic_pic'] ;
echo '<td><center><a href="picture.php?&id=' .
$row['id'] . '"><img
style="width:174px; height:174px" border="0"
src="'.$PICnewPath.'"
alt="'.$row['topic_title'].'"
title="'.$row['photo_name'].'"
/></a></center>' . $row['topic_title'] . '</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>';
}
}
?>
<tr>
<td><?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'].'?lan='.$lan.'&id='.$id.'&page='.$i.'"
class="shift">'.$pageNum.'</a></b> ';
}
}
}
?>
=============
thanking you in advanced --