Hi All:
Here is my issue: I will have the following tables:
Venue:
ID | Name | Demographics
Venue Type:
ID | Title|
Venue by Type:
Venue ID | Venue Type ID
My question is if I have form used to enter enter a venue with muliplte venue types (check boxes), what is the theory behind adding adding info to the Venue by Type Table?
As it stands now, I only have 2 tables, Venue and Venue Type, but I can only have a one to one match.
Add to Muliple Tables
Moderator: General Moderators
-
thinsoldier
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
Re: Add to Muliple Tables
This might not be the best way but it's how I do it.
If you're creating a new venue, after it's inserted grab it's id number (mysql has get_last_id mysql function or something)
then using that id add it and each selected venues to your venue by type table
If you're creating a new venue, after it's inserted grab it's id number (mysql has get_last_id mysql function or something)
then using that id add it and each selected venues to your venue by type table
Warning: I have no idea what I'm talking about.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Add to Muliple Tables
You can also use what is called a Sequence to generate an ID to use as the key for all records. Some databases like Oracle and Postgres support Sequences, others like MySQL you need to emulate them with a table with an autoincrement column.
(#10850)
Re: Add to Muliple Tables
Many to many associations are typically done with association tablescupaball wrote:what is the theory behind adding adding info to the Venue by Type Table?
As it stands now, I only have 2 tables, Venue and Venue Type, but I can only have a one to one match.