Ok, i have successfully managed to populate a javascript array with MySQL data using PHP... now I need help with something though...
I have these lines of code, that will create my multiple array entries:
while ($owners = mysql_fetch_array($result)) {
$id=$owners['id'];
$name=$owners['name'];
$address=$owners['address'];
$city=$owners['city'];
$postalcode1=$owners['postalcode1'];
$postalcode2=$owners['postalcode2'];
$phonenumber1=$owners['phonenumber1'];
$phonenumber2=$owners['phonenumber2'];
$phonenumber3=$owners['phonenumber3'];
echo "AddressArray[1] = new Address(\"$name\", \"$address\", \"$city\", \"$postalcode1\", \"$postalcode2\", \"$phonenumber1\", \"$phonenumber2\", \"$phonenumber3\");\n";
}
The problem is with this line:
echo "AddressArray[1] = new Address(\"$name\", \"$address\", \"$city\", \"$postalcode1\", \"$postalcode2\", \"$phonenumber1\", \"$phonenumber2\", \"$phonenumber3\");\n";
I need to figure out a way for the array to auto-increment for each entry its creating, instead of just having the AddressArray[1]... the 1 needs to be a dynamic, auto-incrementing number... can anyone help me?