[thelist] Query help?

Andrew Maynes andrew at humanbehaviour.co.uk
Sun Feb 23 06:45:01 CST 2003


Hi All

I have asmall problem and I am nearly there with it! :)

If anyone can help that would be great if you don't have time no worries it just
means I will be scratchig my head a bit longer:)

I am pulling CityID from city and using the records as a nav.

$result=mysql("$DBName","SELECT * FROM city ORDER BY City");
echo "Select a City:<br><br>";
echo "<ul>";
while ($row  =  mysql_fetch_row($result)) {
$City=$row[0];
$CityID=$row[1];
echo "<li><a href='$Relative/$City/index.php?CI=$CityID'>$City</a></li>";
        }
echo "</ul>";

The selected city takes the visitor (selector) to their chosen city where the
nav changes to 'category'


$result=mysql("$DBName","SELECT * FROM category ORDER BY Category");
echo "If we missed one let us know:<br><br>";
echo "<ul>";
while ($row  =  mysql_fetch_row($result)) {
$Cat=$row[0];
$CatID=$row[1];
echo"<li><a href='$Relative/items.php?CA=$CatID&CI=$CityID'>$Cat</a></li>";
        }
echo "</ul>";

What I need to do is pass the CityID through so that the selections (items) for
the chosen city relate to the category's for that city.

The help I would appreciate is with the query and getting the CityID to follow
through?

All the records for all city's are in one table (items) where both Category and
CityID are columns.

There are three tables City Category and Items (Items will be changing to
Company but this is irrelevant)

I think its this query i need to change but I am not getting anywhere..
$result=mysql("$DBName","SELECT * FROM category ORDER BY Category");

do I need to select from items CityID ?

Andrew




More information about the thelist mailing list