Jump to content

Display record with image link


gilanib

Recommended Posts

Greetings!

I have a website www.lanceronlinejobs.com/our_franchises.php I have a franchise images. I want to display each franchise record from database whenever a user click on franchise link. Here is my code.

ourfranchises.php  code:

 

<?php 
include('fconnection.php');

$sql = mysql_query("SELECT * FROM tbl_franchise ORDER BY id DESC") or die(mysql_error());
$row3 = mysql_fetch_array($sql); 
?>
<a href="franchiseDetails.php?city=<?php echo $row3['city'];?>"><img src="images/lbatkhela.jpg" width="150" height="150" alt="Batkhela" /></a>

----------------------------------------------------------------------

 

franchiseDetails.php code:

 

<?php
$id = $_GET['id'];

$query = "SELECT * FROM tbl_franchise WHERE id = '$id' ORDER BY id DESC LIMIT 1";

$result = mysql_query($query);

if (!$result) {
echo "NO RECORD FOUND";
} else {

while($row3 = mysql_fetch_array($result)):
?>

Manager Name: <?php echo $row3['manager_name'];?>

 

Please help me. Any help would be appreciated.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/257752-display-record-with-image-link/
Share on other sites

Greetings!

I have a website www.lanceronlinejobs.com/our_franchises.php I have a franchise images. I want to display each franchise record from database whenever a user click on franchise link. Here is my code.

ourfranchises.php  code:

 

<?php 
include('fconnection.php');

$sql = mysql_query("SELECT * FROM tbl_franchise ORDER BY id DESC") or die(mysql_error());
$row3 = mysql_fetch_array($sql); 
?>
<a href="franchiseDetails.php?city=<?php echo $row3['city'];?>"><img src="images/lbatkhela.jpg" width="150" height="150" alt="Batkhela" /></a>

----------------------------------------------------------------------

 

franchiseDetails.php code:

 

<?php
$id = $_GET['id'];

$query = "SELECT * FROM tbl_franchise WHERE id = '$id' ORDER BY id DESC LIMIT 1";

$result = mysql_query($query);

if (!$result) {
echo "NO RECORD FOUND";
} else {

while($row3 = mysql_fetch_array($result)):
?>

Manager Name: <?php echo $row3['manager_name'];?>

 

Please help me. Any help would be appreciated.

 

Thanks.

 

Hi!

 

Would you please describe in a bit more detail what your issue here is? It's probably just me not understanding here LOL. Also, I think it would be a good idea to use mysql_num_rows at some point.

 

James.

Yes you are right. variables must be same.

 

Dear actually I have a franchise page where my company's franchises shown as a image. So what I want is that when a user click on an image like "Batkhela", The next page will display the Batchela's franchiser details [manager name] [city] .

 

Please help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.