Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing Problem

Status
Not open for further replies.

overyde

Programmer
Joined
May 27, 2003
Messages
226
Location
ZA
Hi,
I'm developing a site that has a listing of retailers.
The user can then click on the name of the retailer and a new page with its details would come up.

My problem is when I have franchise branches listed on it. I do not want to list every branch the franchise has on the same page as the rest of the retailers. I would like to set it so the franchise name would come up and there would be a link and the listing of branches of that particular franchise would come up in a new page.

I'm using php4 and MySQL.

Any ideas?


<?php

// open the connection
$conn = mysql_connect(&quot;localhost&quot;, &quot;&quot;, &quot;&quot;);

// pick the database to use
mysql_select_db(&quot;imperial&quot;,$conn);

// create the sql statement
$sql = &quot;SELECT cat, sub, vname, vtel, vaddress, id, specials FROM place order by vname&quot;;

// execute the sql statement
$result = mysql_query($sql, $conn) or die(mysql_error());

print &quot;<table border=1><tr><th><font class=\&quot;header\&quot;>Name</font></th>&quot;;
print &quot;<th><font class=\&quot;header\&quot;>Category</font></th><th><font class=\&quot;header\&quot;>sub</font></th><th><font class=\&quot;header\&quot;>Specials</font></th><th><font class=\&quot;header\&quot;>Address</font></th><th><font class=\&quot;header\&quot;>Telephone</font></th></tr>&quot;;

// go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields
$cat = $newArray['cat'];
$sub = $newArray['sub'];
$vname = $newArray['vname'];
$vtel = $newArray['vtel'];
$vaddress = $newArray['vaddress'];
$idv = $newArray['id'];
$specials = $newArray['specials'];


//echo the results on screen
echo &quot;
<tr>
<td><a href=\&quot;view.php?lnk=$idv\&quot; target=\&quot;_blank\&quot;>$vname</a><br><font class=\&quot;listing\&quot;>$vaddress</font></td>
<td><font class=\&quot;listing\&quot;>$cat</font></td>
<td><font class=\&quot;listing\&quot;>$sub</font></td>
<td><font class=\&quot;listing\&quot;>$specials</font></td>
<td><font class=\&quot;listing\&quot;>$vaddress</font></td>
<td><font class=\&quot;listing\&quot;>$vtel</font></td>
</tr>&quot;;
}
print &quot;</table>&quot;;
?>


Reality is built on a foundation of dreams.
 
now i want some more answers. in what table are the franchisees stored?

i want a brief outline of ur DB.

Known is handfull, Unknown is worldfull
 
The stores are all listed on one table. Each store has two numbers. One is a primary key. Each restaurant is then allocated another number. If there are two or more of a specific store then the number is replicated i.e.

Hardware store a = hw001
Hardware store b = hw002
Hardware store ci = hw003
Hardware store cii = hw003
Hardware store d = hw004

What I was thinking of doing in theory was telling the dbase that if there were more than 1 of the franchise number (i.e. hw003) then the ahref link would be different and would link to a page that would list those branches.
Not sure how to implement this though?!!?

Reality is built on a foundation of dreams.
 
o.k is this what u want?

if there are:
Hardware store ci
Hardware store cii
Hardware store ciii

then there must be a link called:
&quot;Hardware store c&quot;
which will go to a page where restaurants:

Hardware store ci
Hardware store cii
Hardware store ciii
will be displayed? i think that is very tough. u have set me thinking. as soon as i get an idea i'll be back...


Known is handfull, Unknown is worldfull
 
That's exactly what I'm looking for!!!

Reality is built on a foundation of dreams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top