Hi,Pagination Problem : It shows the pages i.e 1,2,3 as number of records, but further records are not shown when clicked on page 2 further 3 and soo on..

Database Connectivity:

$query = "SELECT * FROM photos ORDER BY id DESC limit 1,2";

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
	$image_stat1= $row["image_path"];
	
?>

2nd Php tag which shows the pages

$sql = "SELECT COUNT(id) FROM photos"; 

$rs_result = mysql_query($sql);
$row = mysql_fetch_row($rs_result); 
$total_records = $row[0]; 
$total_pages = ceil($total_records / 2); 
 
for ($i=1; $i<=$total_pages; $i++) { 
echo "<a href='gallery_retrieve.php?idd=".$i."'>".$i."</a> "; 
}; 
?>
</table>
</form>

Recommended Answers

All 3 Replies

Member Avatar for diafol

You don't include the code for processing the querystring (idd). Can I suggest you search this forum for 'pagination'? It has been covered a million times every week since I've been here. *sigh*

Ardav: Kindly paste the link of the specific querystring which u are talking about ,so that i may directly jump to it for the solution which i am finding out.
Thanks

Member Avatar for diafol

Me > You don't include the code for processing the querystring (idd)

You > Kindly paste the link of the specific querystring which u are talking about gallery_retrieve.php?idd=... Where is the code showing how you deal with the $_GET variable?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.