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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.