Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to open a target image loaded from a mysql database to a new page using php, just like when you click on a product in an e-commerce websites it opens that target image into a new dynamic page (a new page). All help welcome thanx :)
Posted

1 solution

and the code below not tested it's just for to show u an example.

if i understand you correctly, you neeed two php pages.
1. index.php - use for fetch all the images links in the page
PHP
index.php
	$query = "select * from tbl_image;
	$stmt = $dbo->query($query);
	while($row = $stmt->fetchAll(PDO::FETCH_ASSOC) {
		echo "<a href=/display.php?id=" . $row['id'] . ">" . $row['name'] . "</a>"
	}


2. you need display page to show image that user clicked.

PHP
display.php
	
	$id = $_GET['id'];
	$query = "select * from tbl_image where id=:id";
	$stmt = $dbo->prepare($query);
	$stmt->bindParam(":id", $id);
	$stmt->execute();
	while($row = $stmt->fetchAll(PDO::FETCH_ASSOC) {
		//fetch the info in page as you needed.
	}
 
Share this answer
 
v3
Comments
narenamarsharma 30-Sep-15 1:54am    
That answer worked out for me thanx :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900