PHP
  Home arrow PHP arrow Page 3 - Statistical View of Data in a Clustered Ba...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
VeriSign Whitepapers 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Statistical View of Data in a Clustered Bar Chart
By: Muhammad Naeem
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 47
    2003-12-01

    Table of Contents:
  • Statistical View of Data in a Clustered Bar Chart
  • Database
  • Getting Down and Dirty
  • Drawing Charts
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Statistical View of Data in a Clustered Bar Chart - Getting Down and Dirty


    (Page 3 of 5 )

    An HTML user interface is used to populate all of the four tables. First fill the programs and subjects tables, then populate the students table and in the final, give records to the marks table.

    I shall not go into explaining how these four tables have been populated from the html forms, as I’m under the impression that this would be a trivial task.  Rather, I shall focus on how the statistical view is created.

        Our input HTML form and related PHP processing code has been written in such a way that it can be enhanced easily. The code snippet for the user input form is composed of three related web controls which pull the data from three tables. Here, these three controls are web control arrays:

    <?php
       $query = "select s.id , s.name from students as s order by s.name";
       $result = mysql_query($query);    
     php?>
      <select name= "sel_id[]" size = "10"  multiple  style = "background-color: #ffffe8;" >
      <?php
        while ($row = mysql_fetch_row($result))
          echo "<option value=" . $row[0] . ">" . $row[1] . "</option>";   
      php?>
      </select>

    The remaining two web controls are also populated in the same fashion:

    <?php
       $query = "select p.id , p.program from programs as p order by p.program";
       $result = mysql_query($query);    
     php?>
      <select name= "sel_program_id[]" size = "5"  multiple  style = "background-color: #ffffe8;" >
      <?php
        while ($row = mysql_fetch_row($result))
          echo "<option value=" . $row[0] . ">" . $row[1] . "</option>";   
      php?>
      </select>

    <?php
       $query = "select s.id , s.subject from subjects as s order by s.subject";
       $result = mysql_query($query);    
     php?>
      <select name= "sel_subject_id[]" size = "5"  multiple  style = "background-color: #ffffe8;" >
      <?php
        while ($row = mysql_fetch_row($result))
          echo "<option value=" . $row[0] . ">" . $row[1] . "</option>";   
      php?>
      </select>

    Also, the range of a date can be provided as an input from the same page. The code snippet will further explain this; it has been repeated twice, once for Date (From) and again for Date (To).

    <?php
    $months = array (1=>"January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December");
    php?>

    <tr><td colspan=2 align=center><table border=0>
      <tr><td>Date (From)</td>
      <td>
        <select name="sel_day_from">
        <?php
     for ($i = 1; $i < 10 ; $i++)
             echo "<option value=0".$i.">" . $i . "</option>";
          for ($i = 10; $i < 32; $i++)
             echo "<option value=".$i.">" . $i . "</option>";
        php?>
        </select>

        <select name="sel_month_from">
        <?php
     for ($i = 1; $i < 10 ; $i++)
             echo "<option value=0".$i.">" . $months[$i] . "</option>";
          for ($i = 10; $i < 13; $i++)
             echo "<option value=".$i.">" . $months[$i] . "</option>";
        php?>
        </select>

        <?php $dt_y = intval(date(Y)); php?>
        <select name="sel_year_from">
        <?php
         for ($i = $dt_y; $i > 2000; $i--)
             echo "<option value=" . $i . ">" . $i . "</option>";
        php?>
        </select>
      </td></tr>

    This is just a simple way in which to offer more options.  There is very little you have to do on the processing side.  Also, a new dimension will be processed in your bar chart.

    So far on our input forms, there are four criteria the user can choose from:

    • student name
    • subject
    • program
    • and range of Date

    Our database is now ready to be subjected to operations under drawing bar charts.

    More PHP Articles
    More By Muhammad Naeem


     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway