Hi Everyone, How do I extract specific data from a database without having to write hundreds of different mysql commands? For example, if I want to extract then display only "car dealers" in New York City on my "New York City Page" --->> mydomain.com/new-york-city/used-cars. How would I make a script that will only "pull" or "extract" new york city car dealers without having to write different mysql commands? Thanks
For example, In the below URLS everypage has unique car dealer information. How would I write maybe one or two php scripts to extract and then display location specific information? http://www.automobilemag.com/31/new_york/auto_dealers/ http://www.automobilemag.com/31/new_york/new_york/auto_dealers/ http://www.automobilemag.com/31/new_york/rockland/auto_dealers/
You obviously have never read a single article on mySQL. mySQL is searchable right out of the box via SQL queries. You don't need to execute 1,000 queries to fetch a result set. In most cases you just need 1. You questions leaves us to make ASSUMPTIONS and GUESSES about your database when we know nothing about it. So to answer your vague question you would use the SELECT function to fetch results. Like so: SELECT dealer_name, dealer_make, dealer_address, dealer_state FROM Dealers WHERE dealer_state = 'NY'; Assumptions: 1) You have a table named "Dealers" 2) Your database is set up with at least the following columns: dealer_name, dealer_make, dealer_address, dealer_state 3) dealer_state holds a 2 character state prefix 4) You want to display all dealers from the state of New York.
I want to display all dealers on my website but if a dealer is from NYC then I want to have a "NYC" page on my website. If a dealer is from Los Angeles then I want to have a "LA" page on my website. On my "NYC" and "LA" pages I only want dealers from those locations. Here is my data. I have a name, address, state and city columns. http://whatsmyowncarworth.com/practiceTemplate/practice1/33/loans/table.php What I'm trying to do is "make" or "dynamically" build pages that correspond with locations/dealers. If a dealer in my database is from NYC then I want my php script to build a page that targets dealers from NYC. If a dealer is my database is from Los Angeles California I want my php script to build a page that targets dealers in Los Angeles without having to manually make a mysql indivually to extract specific dealers in LA. I want my mysql statement to be generic so that it extracts dealers from every state/city and I'm "guessing" I would have to make a php script that would allow me to "make" or "build" those types of pages. Are I correct?
You are still using the SELECT statement in my example to display the content accordingly. Just replace my column names with yours. If you want to list all States and Cities you will need a "Zipcode Database".