I want to display each franchise record from database whenever a user click on franchise link.
DO we assume you mean to display data from ONE record based on the city parameter in the url?
diafol
Keep Smiling
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,537
Skill Endorsements: 61
<?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>
This will just print one city link (the first one) as you don't have a while loop. No text is shown with this link, just an image. Tooltip (alt) - try using 'title' attribute too.
Is this what you want? Seems wrong to query the whole tbl_franchise table and then just use the first record.
==============
<?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'];?>
I'm assuming this is coming from the previous script link. Again this makes little sense as you're ORDERING BY id, but limiting it to one id, which I assume is unique. Odd.
For this recordset, you one have one record, but then go on to loop over it with a 'while'. This makes no sense.
You seem to have mixed up the purpose of using a loop.
BTW: your get variable should be $_GET not $_GET
I recommend you have a look at the php.net site and learn the basics of loops (for, while, do)
diafol
Keep Smiling
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,537
Skill Endorsements: 61
Hi, well first thing your passing the variable city to the franchiseDetails.php file, and asking for the id variable...
So just change this and it should work.
<a href="franchiseDetails.php?id=<?php echo $row3['id'];?>"><img src="images/lbatkhela.jpg" width="150" height="150" alt="Batkhela" /></a>
Thanks,
Marais
marases
Junior Poster in Training
92 posts since Sep 2010
Reputation Points: 21
Solved Threads: 7
Skill Endorsements: 0