Here's what I have:
In file containging functions:
global $numTrax;
then I call a function within html page which is simply html for the player, but, at that point i want to put in how many tracks it plays so:
audioPlayer(5);
and the function is
function audioPlayer($numTrax)
{
echo ' ... all html ...';
// if i echo $numtrax here it shows 5
// because function i used was audioPlayer(5)
// so, i'm reassigning it using $numTrax = $numTrax
// then next function: audioPlaylist($user_id,$username,$numTrax); has $numTrax
// but the problem is it's not showing it there
$numTrax = $numTrax;
return $numTrax;
}
then I have another function further down the page which creates the track list and is called as follows:
audioPlaylist($user_id,$username,$numTrax);
The problem is that $numTrax is not being carried through
QUESTION Can I make the variable $numTrax travel through the functions?
globalonce somewhere does not mean that variable is available in all functions! Are you passing the variable around somehow? Or are you just relying on your oneglobalstatement to make it pass magically?global. Ever. It's a crutch, and a dangerous one at that. 2. Can you show how you attempt to invoke the function? Does$numTraxexist at that point?global $numTraxoutside a function and that's it? You are not passing the variable into the function when calling it? That's not very clear.audioPlayer- but then show us a separate function's invocation -audioPlayList. We can't tell what's going on without seeing that function's definition, or how you've used$numTraxto that point.