Page 1 of 1
general php quastion
Posted: Mon Aug 10, 2009 2:18 am
by mellowman
ok so this is still in concept mode so i don't have a example right now.But here it goes.
So im trying to make a mp3 site that can add music to a to mp3 player just a simple add song button but im using a database to pull in the location of the mp3 to load the song.But the problem im having is not that part but its the part when it trys to add it to the mp3 player it dosnt know wheather to put it in the first slot or second slot.because how would it know if slot one or 2 is taken.
And i heard from a friend that an array would be able to solve my answer but i tryed looking into it and i dont know how it would solve the problem because and array doesn't fix a "ifset" problem.nore does the ifset function :[
Re: general php quastion
Posted: Mon Aug 10, 2009 2:58 am
by frao_0
yes, an array does have an 'ifset' function!
Yet, for your project, people usually go like Winamp or iTunes, which means having a XML representation of a database. Have you consider Flex for this project? Do you want to do something like playlist.com?
Re: general php quastion
Posted: Mon Aug 10, 2009 4:07 am
by mellowman
yes similar to playlist.com but i would have many..improvements in my eyes....But ive never seen flex before i looked it up and its cool but it seems easyer to just structure "playlists" in a database instead of a xml file so that u have less files 1 and 2 easyer to save the data by querying a database table that has all the songs that u have saved to the playlist.
But if u have another suggestions on how to layout this wheather xml or database please explain y..it would help alot

Re: general php quastion
Posted: Mon Aug 10, 2009 4:34 am
by onion2k
mellowman wrote:So im trying to make a mp3 site that can add music to a to mp3 player just a simple add song button
Can't be done with an iPod. That's going to be a problem.
Re: general php quastion
Posted: Mon Aug 10, 2009 6:01 am
by mellowman
onion2k wrote:mellowman wrote:So im trying to make a mp3 site that can add music to a to mp3 player just a simple add song button
Can't be done with an iPod. That's going to be a problem.
there wont be any point in an ipod there will be a archive of music to pick from..Like any song...And u can share your playlist with others :]...And i hope u know this isnt a program its a website acting as a site for your music u pick from and share.
Re: general php quastion
Posted: Mon Aug 10, 2009 6:30 am
by onion2k
Err.. so what does "that can add music to a to mp3 player" mean then? Do you mean "MP3 player" in the sense of a Flash application that plays MP3s? Or an MP3 player like an iPod?
Re: general php quastion
Posted: Mon Aug 10, 2009 10:58 am
by mellowman
As in a flash mp3 player that plays music u picked from the site.
Re: general php quastion
Posted: Mon Aug 10, 2009 1:15 pm
by frao_0
Ok, can you rephrase your question then? What do you mean by "slot"?
Re: general php quastion
Posted: Mon Aug 10, 2009 3:17 pm
by mellowman
ok so the way i set up the mp3 player is in 2 versions
1.non registered users<--uses sessions to store data
2.registered user<---pulls from database
Now for the question about the slot problem.The way im doing it for the first version is with sessions and having names like
Session['song'1']<---im using lamins terms
Session['song'2']
Session['song'3']
Session['song'4']
Session['song'5']
But when i submit the song how does it check if session 1 or 2 is taken and to put it into the 3rd session...
And could someone explain this to me..never really understood the hole array concept
Re: general php quastion
Posted: Wed Aug 12, 2009 11:58 pm
by mellowman
...fixed my problem alredy:]
heres the fix if any needs it :]
Code: Select all
<?php
session_start();
function addsong ($songname)
{
if (array_key_exists("songs", $_SESSION))
{
$songs = $_SESSION['songs'];
}
else
{
$songs=array();
}
array_push($songs, $songname);
$_SESSION['songs']=$songs;
}
addsong ($_POST['songname']);
$songs = $_SESSION['songs'];
?>