Forum Moderators: coopster
I need to pull data from a mysql table and feed it into a prebuilt function, which accepts arrays as input.
I can use mysql_query successfully and display results with while fetch array - but I can't seem to find any infomation on how to take the array ($result for example) and use it in another array. Here's what I have:
$arr = Array(
'First Trimester' => Array(1000,200,100,1000,50),
'Second Trimester' => Array(1200,200,200,10,20),
'Third Trimester' => Array(-500,23,255,100,15)
);
The important vaule being the first.
I imagine it would look like this:
first trimester => array ($valuepulledfromresult, 200, 100, 50)
I'm just now entirely sure how to achieve this.
[au2.php.net...]
I've had some thought about this - I think I've got it.
I can do this (answering my own question)
$example = $row{'title'];
And I think I can use a while loop to extract as many new variables as possible. Something like $example[1], $example[2] ect.
The question is how do I set a while loop to add 1 to the variable number every time?
//this is just showing you how to
//use a counter your while could
//contain any condition. in your
//specific reference it would be
//the wile loop that goes through all of
//your data
while($count <= 10){
//here is the example to show
//the counter
echo("the counter for example is" $count);
$count++;
}
Run that code really quick it should explain it to you.