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.
> [EMAIL PROTECTED]
> -- 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
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
I really don't see you would create tables for every business type.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php