btc_uk
01-08-2007, 04:46 PM
Hi,
I am trying to load numbers from a list in a MySQL database (I have no problem doing that) then I need to seperate them all out and have a variable for each.
For example, I have 6 comma seperated values stored in a datbase (1,2,3,4,5,6 for example) I then need to set a variable for each e.g. $n1 is set to 1, $n2 is set to 2, $n3 is set to 3, and so on (obviously these won't be the actual numbers, otherwise I could have just hard-coded them) and then I will be using these values in the rest of the script.
I can not change it so that the values from the database are provided any other way - they are always in this format.
Say the list in my database looks like this... 1,2,4,8,16,32
I would want variables like this:
$1 = 1
$2 = 2
$3 = 4
$4 = 8
$5 = 16
$6 = 32
Any help you can provide is much appreciated.
Ben
I am trying to load numbers from a list in a MySQL database (I have no problem doing that) then I need to seperate them all out and have a variable for each.
For example, I have 6 comma seperated values stored in a datbase (1,2,3,4,5,6 for example) I then need to set a variable for each e.g. $n1 is set to 1, $n2 is set to 2, $n3 is set to 3, and so on (obviously these won't be the actual numbers, otherwise I could have just hard-coded them) and then I will be using these values in the rest of the script.
I can not change it so that the values from the database are provided any other way - they are always in this format.
Say the list in my database looks like this... 1,2,4,8,16,32
I would want variables like this:
$1 = 1
$2 = 2
$3 = 4
$4 = 8
$5 = 16
$6 = 32
Any help you can provide is much appreciated.
Ben