Name: Alex 2010-04-17 0:42
function randomAlbum($singleRandomArtist)
{
$artists = file('resources/artists.txt');
$firstReturn = true;
foreach ($artists as $singleArtist)
{
$randomArtist = explode("~", $singleArtist);
if ($firstReturn == true)
{
echo $randomArtist[$singleRandomArtist]; *****
$firstReturn = false;
}
else;
}
}
function getRandomInt($min, $max)
{
$validRand = false;
while ($validRand == false)
{
$random = rand($min, $max);
if (($random % 3) == 0)
{
$validRand = true;
}
else;
}
return $random;
}
The line with the *** next to it is giving me an undefined offset error. Any ideas why? Im rather new to php, so be nice!
{
$artists = file('resources/artists.txt');
$firstReturn = true;
foreach ($artists as $singleArtist)
{
$randomArtist = explode("~", $singleArtist);
if ($firstReturn == true)
{
echo $randomArtist[$singleRandomArtist]; *****
$firstReturn = false;
}
else;
}
}
function getRandomInt($min, $max)
{
$validRand = false;
while ($validRand == false)
{
$random = rand($min, $max);
if (($random % 3) == 0)
{
$validRand = true;
}
else;
}
return $random;
}
The line with the *** next to it is giving me an undefined offset error. Any ideas why? Im rather new to php, so be nice!