Business Directory using ASP
I'm creating a business directory for my site. I'm creating an ASP page for each category - Automotive, Business, etc. I have all of the individual business information in one database.
I'm having an issue trying to figure out to display the listings of each individual category. In my access database I have a field called "category" but I only want the listings for Automotive display on the auto.asp page, for example.
I'm trying to figure out the Query I'd need. I'm thinking it's somthing like this: SELECT *
FROM database
WHERE Cat1 = Automotive
ORDER BY Company ASC
Can anyone help me out?
kb posted this at 19:25 — 13th July 2007.
He has: 1,380 posts
Joined: Feb 2002
Yeah, that would probably work, but not knowing your structure it's hard to say. And why ask us? Why not try it, debug it, and if you still can't figure it out THEN ask? That's pretty much the point of this site...
Something you might want to also look at (since I know nothing about your database) is the LIKE attribute. It's similar to WHERE except that it allows for variables, so you might do something like...
<?php
SELECT id, boat, dungeon FROM castle_frankenstein WHERE boat LIKE '%$needle%' ORDER BY id DESC
?>
So in that example, it would get the fields 'id', 'boat', and 'dungeon' from the table 'castle_frankenstein', and return results that have the contents of the $needle variable inside the 'boat' field... all in descending order based on the id value.
Also, in your question, you say "WHERE Cat1 = Automotive" ... make sure you're using quotes after the equal sign.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.