seniorfisker
-
Posts
2 -
Joined
-
Last visited
Posts posted by seniorfisker
-
-
I have this array that I will use for the SVGGraph chart class
I can easily get it working by setting in data manually in the code like this:
(This is an example from the SVGGraph web)
$values = array(
array('Dough' => 30, 'Ray' => 50, 'Me' => 40, 'So' => 25, 'Far' => 45, 'Lard' => 35),
array('Dough' => 20, 'Ray' => 30, 'Me' => 20, 'So' => 15, 'Far' => 25, 'Lard' => 35,
'Tea' => 45)
);
but
I want to put in the data from 2 MySql functions (one for each chart line)
I have tested the queries with simple arrays so I'm sure that they work
But I can't find out how to copy the values from the MySql result into the arrays
if (mysqli_multi_query($link, $query))
{
do
{
if ($result = mysqli_store_result($link))
{
while ($row = mysqli_fetch_row($result))
{
if ($snr==1){
$values[0][0][$cnt] = ''; // here should the 'dough' type values go
$values[0][1][$cnt] = $row[0]; // And here the number
}else{
$values[1][0][$cnt] = '';
$values[1][1][$cnt] = $row[0];
}
$cnt++;
$reccnt=$cnt;
}
mysqli_free_result($result);
}
if (mysqli_more_results($link))
{
$snr=2;
$cnt=0;
}
} while (mysqli_next_result($link));
}
mysqli_close($link);
How to copy data to array of arrays
in PHP Coding Help
Posted
I have found a solution now - but I don't know how to set the 'answered' label on the question