473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Entering Data Into A Bridge Table (With php?)

I'm new to database design, but I understand the basics of MySQL and php.

To make a simple music database in MySQL, I've made a table of songs
(song) and a table of
players (player) joined by a bridge table (song_play) to allow
many-to-many
relationships...eg:

create table song
(song_id int primary key,
name char(30));

create table player
(player_id int primary key,
name char(30));

create table song_play
(song_id int not null,
player_id int not null,
primary key(song_id, player_id));

Once the names of songs and players are entered into their respective
tables, is there a way to use php to enter data into the join table other
than manually looking up the id's from song and player and entering those
into song_play?

Thanks,

Babs

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 17 '05 #1
1 2863
I noticed that Message-ID: <op**************@news.west.cox.net> from
Babs Patel contained the following:
Once the names of songs and players are entered into their respective
tables, is there a way to use php to enter data into the join table other
than manually looking up the id's from song and player and entering those
into song_play?


Query the database and use the results to populate something like drop
down boxes. On Submit the selections add a row to the join table.
However this could get really unweildy with large numbers of
songs/artists so you have to add some criteria to the initial query.

In practice though, would you not be doing this when you added new
songs? Something like:

Enter song
insert record into song table
enter player
If player exists, display player details
else prompt to enter player details and then insert record into artist
table.
Display player details
insert record into song_play table

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Willoughby Bridge | last post by:
I am trying to post from a form to table using the code below from file2.php and having two problems: 1. The data is not being posted to the table 2. After submit is pressed the following message...
9
by: Steven M. Scotten | last post by:
Hi-- I seem to have the PHP Java Bridge (2.0.5 built from tarball) working with PHP 5.0.3 (also built from tarball) on my Fedora Core 1 server with Apache 2.0.50 and I'm pretty excited about it...
1
by: Erwin S. Andreasen | last post by:
I have a Python application server that manages several different data sets, permits various reports to be run on them and the data to be downloaded as tab-delimetered files, all via a web...
0
by: Babs Mattel | last post by:
I'm new to database design and need some help. To make a simple music database, I've made a table of songs and a table of players joined by a bridge table (song_play) to allow many-to-many...
2
by: Joey Martin | last post by:
I have two tables: customermaster (id,name,email,mailinglists) example: 1,john doe, johndoe@nowhere.com, NULL emailmaster (email,listid) example: johndoe@nowhere.com 1 johndoe@nowhere.com ...
3
by: Raj | last post by:
Hi, I am trying to add some more information to the table which already has a lot a data (like 2-3000 records). The new information may be adding 2-3 new columns worth. Now my questions are:...
4
by: jos | last post by:
Hi There, What would be suitable options to exchange data between a Dot net program and a java program? Thanks Jyotsna Sharan
2
by: robertns5411 | last post by:
I have two questions: 1) Say I have a form bound to a table. Assume the user is entering data into a new record at the bottom of the form. Now, suppose the user clicks a button on the form...
4
by: Neil | last post by:
Having trouble with inserting a record into a table. It's a list of names. But, for some reason, it won't take a particular name. When a user tries to enter a name into the table, the system hangs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.