[thelist] Query help?

Andrew Maynes andrew at humanbehaviour.co.uk
Sun Feb 23 07:53:01 CST 2003


thanks rudy

This might sound really dumb but here it is anyway: In the table category there
are only two columns Category and CategoryID

I have changed your query to represent the correct names of the columns:

select CategoryID, Category
    from category
   where CityID = $cityid
  order by Category

But... CityID is held in the items table.

I just tried the query and its throwing a row error .

he query  have now is this $result=mysql("$DBName","SELECT Category, CategoryID
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>";

When I scroll over the links that are produced from this query Iget this

items.php?CI=&CA=23
items.php?CI=&CA=22
items.php?CI=&CA=21
etc
etc

obviously I should be getting

items.php?CI=9&CA=23
items.php?CI=9&CA=22
items.php?CI=9&CA=21


I am suspecting that I need to query the items table too?  Or is this more
complicated?

Andrew







More information about the thelist mailing list