Help creating inserts to database
Posted: Mon Aug 25, 2008 9:17 pm
deleted
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Database music:
Artists table
id_artist [int primary auto_increment]
name [varchar(200)]
// other
Albums table
id_album [int primary auto_increment]
id_artist [int]
album_name [varchar(200)]
// other
Songs table
id_song [int primary auto_increment]
id_album [int]
song [varchar(200)]
// other
Yeh. I'm not think about this...IF (and it's an important IF) an album has only ONE artist, and IF a song can be on only ONE album, then you won't need those intermediate tables, just the 3 entity tables, as Ziq suggested. However, if the same song could be on several albums, for example, that's a many-to-many relationship and you DO need the intermediate table. Likewise for multiple artists relating to the same album. So, depending on what your data could be like, you may or may not need the 2 intermediate tables.
It's pretty clear from the script that it's searching for a partial artist title give the two wildcard operators at the start and end. LIKE is the right thing to use in that situation.Ziq wrote:FORGET Like operator, use =.