you’re doing all that work in your loops, but you don’t try to do anything with the data until after the loops are done. At this point, you’re left with only the last set of values.
I have some suggestions about how to parse those URLs, too. Give me a few minutes.
yes, that was the other thing: don’t use the `mysql_*` functions. They are deprecated. PDO or MySQL**i** should be used instead.
However, I disagree with putting the query _inside_ the loop: that’s a lot of queries, each requiring a new call to the DB, which takes a lot of time. Instead, you can use your loop to parse/organize all your data, and then do a single query to insert at the end.