How do I pull data from MySQL to use with PHPlot?

by on September 26, 2009

Q: How does one fetch data from MySQL and graph it using PHPlot?

I have looked around for references and none have examples using MySQL.


2 Responses to “How do I pull data from MySQL to use with PHPlot?”
  1.  

    Is the problem that you just don’t know how to connect to MySQL and pull the data or is it that you don’t know how to convert the data that you get back from MySQL to work with PHPlot?

    There are many examples of how to use PHPlot on their site but they show you with just arrays. I think their assumption is that you know how to pull data back from your database of choice and that you can manipulate the data to get in the format that PHPlot needs it.

    The good news is we can help you pull data from MySQL and convert it to work with PHPlot. Just let us know which one you need or if you need both.

     
  2.  

    Thank you!

    I figured out a way to pull the data from mysql, as follows:

    $sql=”SELECT a as value1,b as value2 from table where z”;
    $res=mysql_query($sql);

    while($row=mysql_fetch_assoc($res)) {
    $data[]=$row;
    }

    now, i want to figure out a way to have multiple graphs in one plot. i think it is possible, not sure how to do it…

    thank you for all your help. your site rocks!