Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
my stepping through an array using "next()" is not working.
Old 08-04-2010, 08:30 AM my stepping through an array using "next()" is not working.
Webmaster Talker

Posts: 611
Trades: 0
Hi, I'm trying to step through this array when the "further " button is pressed and it should change the image in the div when I echo it out.

I'm getting the following error

Fatal error: Only variables can be passed by reference in C:\wamp\www\SUN_DRAGON_GAME\gamestart.php on line 224

here is the array

Code:
$currentLocation = array
( 
'teardrop_ocean_bg' => array
   (
   'level_1'=>"<img src='<img src='sundragon_environments/ocean/ocean1_FRAME.jpg'/>'",
   'level_2'=>"<img src='<img src='sundragon_environments/ocean/ocean1_FRAME2.jpg'/>'",
   'level_3'=>"<img src='<img src='sundragon_environments/ocean/ocean1_FRAME3.jpg'/>'",
   'level_4'=>"<img src='<img src='sundragon_environments/ocean/ocean1_FRAME.jpg'/>'",
   'level_5'=>"<img src='<img src='sundragon_environments/ocean/ocean1_FRAME.jpg'/>'"
   )
);
and here is the code I'm using to try to step through the "teardrop_ocean" array.

Code:
$currentLocation='teardrop_ocean';//declare variables/this is set after we click on image map link for teardrop
$currentLocArray='';
//the following is set after we click on the teardrop ocean link on the image map .

//check if the current location is teardrop ocean, if so, set current loc array to the teardrop ocean bg array.
if($currentLocation=='teardrop_ocean'&& !empty($_POST['further']))
{
   $currentLocArray=$currentLocation['teardrop_ocean_bg'];
}

//if in teardrop, and further is pressed, go to next element, which is a new img src background.
if($currentLocArray==$currentLocation['teardrop_ocean_bg']&& !empty($_POST['further']))
{
   next($currentLocation['teardrop_ocean_bg']);
}
any help greatly appreciated. Thanks. Derek

Last edited by silverglade; 08-04-2010 at 08:34 AM..
silverglade is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-04-2010, 08:45 AM Re: my stepping through an array using "next()" is not working.
Webmaster Talker

Posts: 611
Trades: 0
I changed the code. This just shows up a black div. Not the image.
Code:
$currentLocation='teardrop_ocean';//declare variables/this is set after we click on image map link for teardrop
$currentLocArray='';
//the following is set after we click on the teardrop ocean link on the image map .

//check if the current location is teardrop ocean, if so, set current loc array to the teardrop ocean bg array.
if($currentLocation=='teardrop_ocean'&& !empty($_POST['further']))
{
    $echoLocation=next($teardrop_ocean_bg);
}
I output $echoLocation later on inside the div.
silverglade is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to my stepping through an array using "next()" is not working.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.75782 seconds with 12 queries