stormx Posted August 31, 2008 Share Posted August 31, 2008 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: Any would be fine thanks:) Quote Link to comment https://forums.phpfreaks.com/topic/122069-solved-creating-a-graph-out-of-a-table/ Share on other sites More sharing options...
cooldude832 Posted August 31, 2008 Share Posted August 31, 2008 sure we probably do but we aint' gonna give it away for free. You need to examine GD library. Start laying out the framework to the graph and then come back here if u can't figure out how to line up the data to the graph. Quote Link to comment https://forums.phpfreaks.com/topic/122069-solved-creating-a-graph-out-of-a-table/#findComment-630153 Share on other sites More sharing options...
stormx Posted August 31, 2008 Author Share Posted August 31, 2008 Well I know there are numerous graphs around on the internet, but I have no idea on how to get the usage info from the database defining the user ID. Quote Link to comment https://forums.phpfreaks.com/topic/122069-solved-creating-a-graph-out-of-a-table/#findComment-630155 Share on other sites More sharing options...
cooldude832 Posted August 31, 2008 Share Posted August 31, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/122069-solved-creating-a-graph-out-of-a-table/#findComment-630158 Share on other sites More sharing options...
stormx Posted August 31, 2008 Author Share Posted August 31, 2008 Thanks for that Quote Link to comment https://forums.phpfreaks.com/topic/122069-solved-creating-a-graph-out-of-a-table/#findComment-630172 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.