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++; } } Link to comment https://forums.phpfreaks.com/topic/201825-help-with-function/ 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++; } } Link to comment https://forums.phpfreaks.com/topic/201825-help-with-function/#findComment-1058885 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... Link to comment https://forums.phpfreaks.com/topic/201825-help-with-function/#findComment-1058966 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! =) Link to comment https://forums.phpfreaks.com/topic/201825-help-with-function/#findComment-1058972 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.