Re: A challenge

From: Date: Thu, 04 Jul 2002 06:12:35 +0000
Subject: Re: A challenge
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-20313@lists.php.net to get a copy of this message
On Wednesday 03 July 2002 13:27, you wrote: > ... At least, I found it challenging. Hopefully someone here will find > this a lot easier =) > > I am developing a website wherein customers can log in, enter in the > name and type of their business (rather like the yellow pages.) I have a > database of all the customers, and each table in the database is another > type of business. (For example, in the table 'Gyms' all of the places > where you can workout will be listed.) Currently the database has no tables > in it. When a new type of business registers, then the table is created. > In order to prevent many variations of the same table from being created > (I.E. Restaurants, Cafe's, Luncheonettes etc) I have customers choose what > type of business they are from a pull down menu. Here is the challenge: I > would like my users who come to browse to see a similar pull down menu, but > I want this menu only to list those types of businesses that have > registered. Essentially I would like the pull down menu customers see to > be a dynamic list of names of existing tables, updating for each new table > that is created. As for how to do this I'm stuck. It seems that it must be > php that modifies an html form. Any suggestions?? Deeply appreciated. > Thanks. > > jsl@brandeis.edu > -- Jonathan I'm not sure I understand, but you could set it: * A table with customers * A table with business types * A link table with that holds the key to a customer and a business type. A customer can belong to different business type. When a new business is created, you just add an entry to the business type table When a customer assigns himself a business type, you just add a record for this association in the link table. To get the list of business type: select id, name from busitype order by name asc For a search with the $busitypeid variable, you just do select customers.id, customers.name from link left join customers on link.custid=customers.id where link.typeid=$busitypeid I really don't see you would create tables for every business type.

« previous php.db (#20313) next »