Jump to content

[SOLVED] Creating a graph out of a table?


stormx

Recommended Posts

Hello,

 

I was wondering if I could create a graph of some sort out of a PHP table, this is my current code:

 

<?php



$sql1 = mysql_query("SELECT * FROM `user_history` WHERE `userid` = '$user1'") or die("Transaction Error");



$sql1_rows = mysql_num_rows($sql1);







if($sql1_rows == "0") {



echo 'Your Usage Will Start Counting Once Your First Billing Period Has Passed.';



} else {



echo '<table border="0" align="center" width="60%">



<tr>



    <th>Billing Period Ending</th>



    <th>Plan Data Used (MB)</th>



    <th>Off Peak Used (MB)</th>



    <th>Uploads (MB)</th>





</tr>';



while($user_history = mysql_fetch_array($sql1)) {



echo '<tr>



    <td align="center">'.$user_history['billingend'].'</th>



    <td align="center">'.$user_history['used'].'</th>



    <td align="center">'.$user_history['offused'].'</th>



    <td align="center">'.$user_history['uploads'].'</th>





</tr>';



}



echo '</table>';



}



?>

 

I was wondering if someone had a script that looked like this:

 

usageimagett4.png

 

Any would be fine thanks:)

Link to comment
https://forums.phpfreaks.com/topic/122069-solved-creating-a-graph-out-of-a-table/
Share on other sites

you are doing that part already what you don't know is how to build the image and like I said look at GD

 

Start laying out a static graph image and then add in the data once u get the ideas behind GD

 

Barand has written some tutoirals on it that are useful

http://members.aol.com/barryaandrew/baagrid/baagridguide.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.