Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Frenzyy

  • Rank
  1. array_combine was needed to join the two arrays together and then inside of 'function drawChart' a simple foreach loop was required, like this: <?php foreach ($array as $name => $allocation): echo "['$name', $allocation]"; echo ($allocation != end($array)) ? ',' : ''; endforeach; ?>
  2. No, not at all... I don't even want an exact answer if that's what you are thinking. A tutorial or a guide of some sort will be enough... I'm just lost because all solutions I can see are done using SQL and as you can see I'm not using SQL to obtain these arrays. I've tried all kinds of different loops and approaches and just couldn't get it to work. Either blank space or error that tells me that the first column has to be a string or something. You asked me what structure is needed so I provided you with a link to the site from which I got the code for the Pie Chart, given that it was the one
  3. When I do that, I just get an empty space on a site. Ok so essentially, my arrays have to match the structure which Google Charts require. Something like this if I'm not mistaken: https://developers.google.com/chart/interactive/docs/reference So hopefully this gives you an idea as to how my structure currently differs to the one which Google wants. As for how I get the arrays: 1. User adds company X & Y to their portfolio 2. User adds prices at which they bought and how many shares. 3. The site calculates the overall value of each position ('sumOf' is the array which holds all these f
  4. I'm asking this question because all the answers I could find for similar problems were using MySQL whereas I'm not, just a JSON API to get the data, which I then put into arrays that I want to display as a Google graph. All I know is that I have to somehow format the arrays properly in order to get them to display but I have no idea how to do it in my case. I would just like to have a simple pie chart, based on the arrays below. So far I'm getting a blank space on the site. I tried something with Json_encode before but it didn't work so I decided to leave it as it is and come here instead. He
  5. Thanks for your reply. I guess I can use PDO but would that mean that I have to change all the files where I used mysqli to PDO or would it be ok if I just used it from now on? Also, I used var_dump() and this is what I get: var_dump($result); gives me this when I run it: object(mysqli_result)#4 (5) { ["current_field"]=> int(0) ["field_count"]=> int(7) ["lengths"]=> NULL ["num_rows"]=> int(3) ["type"]=> int(0) } Warning: Invalid argument supplied for foreach() in E:\XAMPP\htdocs\Coursework2\Controller\ItemController.php on line 40 Hopefully that helps. //edit This is the
  6. Hi, I'm developing a small web app for uni and one of the requirements is that it has to have a list, with data from a database, that can be sorted by clicking on a certain category and then only the items from that category will get displayed. I've managed to retrieve the data from the database into a table on the website, however, the drop down menu to select which category you would like to look at, doesn't work. Meaning that it displays all the items from the database no matter what. I do not receive any errors and really have no idea how I could solve this problem. Hopefully someone will
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.