Jump to content
Sign in to follow this  
jasperdj

Saving data to array

Recommended Posts

jasperdj

I've been playing around quite a bit, and i can't get this solved.

global $songname[100];
$songname[$num]=$song7;
msgbox(0,"",$songname[$num] & $num)
$num=$num+1

$song7 will be a string that will be different every 'loop', and i want to save all song titels in an array. It seems

that my code does not work, in fact it gives the error:

Array variable has incorrect number of subscripts....

Some help with this would be wonderfull :)

Edited by jasperdj

Share this post


Link to post
Share on other sites
hannes08

Hi jasperdj,

the errormessage you get is typically for accessing an index in the array that does not exist.

E.g. dim $songname[100] defines you an array from $songname[0] to $songname[99], if you try to access $songname[100] it will crash and give you the "Array variable has incorrect number of subscripts" message.

Edited by Hannes123

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites
jasperdj

Ahhh yes how obvious, $num was way above 100. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×