bschultz Posted November 14, 2011 Share Posted November 14, 2011 I need to write a bit of code to select some mp3's (actually, just the titles) from a database...but I need to select them based on last play (which is a timestamp field in the DB) AND I need to select 14 minutes worth of them (and not more than 15 minutes). I currently do NOT know how long each song is... So, if every song was 2 minutes long, I would need 7 songs. If each song was 3 minutes long, I'd need to select 5 of them. I currently do NOT have a length field in the db (the boss sprung this on me after I designed the DB). A few questions: Would it be best to have a column of TIME (mysql time...not the name of the column)? Would it be best to have a column for the raw size of the file (each file is the same bitrate, so I could do the math - plus it would be probably be easier to import raw filesize using php into the db) Would it be easier to do something else? Once we answer that, I'll start with some code...and probably be back for help! Quote Link to comment https://forums.phpfreaks.com/topic/251096-php-or-mysql-to-add-time-of-mp3-file/ Share on other sites More sharing options...
joel24 Posted November 14, 2011 Share Posted November 14, 2011 i would store the time in seconds as an INT field and also store the filesize for future use. Quote Link to comment https://forums.phpfreaks.com/topic/251096-php-or-mysql-to-add-time-of-mp3-file/#findComment-1287931 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.