morocco-iceberg Posted May 15, 2010 Share Posted May 15, 2010 I'm writing a function that will gather and organise data into an array. For some reason I keep getting "syntax error, unexpected '=' " when testing it... function organise($d){ while($$d._ROW = mysql_fetch_array($$d)){ $$d._START[$$d._COUNTER] = $$d._ROW['start']; $$d._END[$$d._COUNTER] = $$d._ROW['end']; $$d._ANSWER[$$d._COUNTER] = $$d._ROW['answer']; $$d._COUNTER++; } } Quote Link to comment Share on other sites More sharing options...
CodeMaster Posted May 15, 2010 Share Posted May 15, 2010 Are you kidding us? function organise($d){ while($ROW = mysql_fetch_array($d)){ $START[$COUNTER] = $ROW['start']; $END[$COUNTER] = $ROW['end']; $ANSWER[$COUNTER] = $ROW['answer']; $COUNTER++; } } Quote Link to comment Share on other sites More sharing options...
morocco-iceberg Posted May 16, 2010 Author Share Posted May 16, 2010 But if I run that function multiple times with a different argument, I won't be able to use the variables I'm creating inside it because it will change each time... Its not in the code that I've posted but I've declared them as global variables... the reason I used variable variables is because if I run organise ('ABC'); I need to be able to use $ABC_ROW later on... Quote Link to comment Share on other sites More sharing options...
morocco-iceberg Posted May 16, 2010 Author Share Posted May 16, 2010 Ohh, I was able to do it a better way and now its working, thank you! =) Quote Link to comment 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.