PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i need foreach $song AND foreach $title coinciding - i have three songs (in my test query) and my attempts have returned NINE combinations, vice just the correct THREE.
i can't find the simple solution, only scads of complex foreach loops ... can someone help?
You should probably be doing the join in your SQL and only querying once.
You should also avoid referencing the returned fields numerically, get MySQL to return the result set as an associative array of fields and your code will be much more self documenting.
right - i've been wondering if i should have had this done before the query, in the db or in the SQL. don't know enough to just go do it, and i was already so close to being done.
thanks - and i see that about $target_row["title"]; versus [1]. didn't know if there were any subtle reasons for one over the other...
thanks. so i need to join these two arrays somehow.
If that's the case, I'd think you be better off re-designing your table setup to have one MP3 / Title pair, rather than using PHP to seperate them out after the query.
When you enter information into that table, only include one piece of information per field. This way, when you run your query, you won't have to parse out data on a per field basis.
well, the problem with that is that the table is already designed for "Artists" (i meant earlier that i wasn't commited to the row, not the entire DB), each artist having many fields, of course (each one is also aready assigned an indivual table for other reasons) - when this need arose i just created a new row in which to enter an array of mp3 names and a row for titles. an artist only has one Pic.
with already over 400 artists and expectations to grow soon, i'm trying to prevent running into a bottleneck later. i'm thinking that i might need to pay close attention to how this is automated right now, rather than later...
i don't want to end up manually entering a Artist name, Pic name, Mp3 name, Title array for each mp3 that's uploaded... do i?
so what the relationship is is that each artist is unique, has a unique pic, and can have multiple MP3's / Titles?
If so, then what you can do is have 2 tables. The first table contains the artist and their pic. The second table would contain
the artist name, MP3, and title. The artist name would be what ties the two tables together, and you would use a join on the two tables to get the information you need.
I think you need some serious re-structuring of your db. You'll be glad you did in the end. If you are not familiar with DB normalization, read this article.
It's written for Java, but the idea is the same. AND, it just happens to use an example that seems very close to what you are trying to do with artists, track names, etc.