seniorfisker Posted March 23, 2013 Share Posted March 23, 2013 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); Quote Link to comment https://forums.phpfreaks.com/topic/276061-how-to-copy-data-to-array-of-arrays/ Share on other sites More sharing options...
Solution seniorfisker Posted March 25, 2013 Author Solution Share Posted March 25, 2013 I have found a solution now - but I don't know how to set the 'answered' label on the question Quote Link to comment https://forums.phpfreaks.com/topic/276061-how-to-copy-data-to-array-of-arrays/#findComment-1420975 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.