Tags

Draw Bar

Draw Bar

1 2 DRILL CHUCK MT2 DRAWBAR ARBOR Lathe
1 2 DRILL CHUCK MT2 DRAWBAR ARBOR Lathe
   US $10.00
Vintage Wood Wooden Draw Bar Pull with Metal Ring
Vintage Wood Wooden Draw Bar Pull with Metal Ring
Paypal   US $11.97
Vehicles Recovery 2 Receiver D Ring Hitch Draw Bar 10K lb Towing Pulling ATV
Vehicles Recovery 2 Receiver D Ring Hitch Draw Bar 10K lb Towing Pulling ATV
Paypal   US $12.99
Hammond M3 M100 Organ 18 Draw Bars 8 Ivory 10 Black MD 199
Hammond M3 M100 Organ 18 Draw Bars 8 Ivory 10 Black MD 199
Paypal   US $29.00
Lionel 773 Hudson Ash Pan Draw Bar Excellent Original Parts
Lionel 773 Hudson Ash Pan Draw Bar Excellent Original Parts
Paypal   US $9.95
360 DIESEL DRAW BAR AMERICAN FLYER TRAINS GILBERT
360 DIESEL DRAW BAR AMERICAN FLYER TRAINS GILBERT
Paypal   US $7.99
Subaru 1 1 4 Draw Bar P N L1010FS030 V 5 K99 TOWING
Subaru 1 1 4 Draw Bar P N L1010FS030 V 5 K99 TOWING
Paypal   US $19.95
7 Antique 1947 John Deere A Farm Tractor Drawbar Cradle
7 Antique 1947 John Deere A Farm Tractor Drawbar Cradle
Paypal   US $9.99
Both 2 Caterpillar D7E Dozers 1 24 CCM Ripper Drawbar Diecast
Both 2 Caterpillar D7E Dozers 1 24 CCM Ripper Drawbar Diecast
Paypal   US $974.94
22 Antique 1947 John Deere A Farm Tractor Straight Drawbar
22 Antique 1947 John Deere A Farm Tractor Straight Drawbar
Paypal   US $10.50
Caterpillar D7E Dozer w Drawbar 1 24 CCM Diecast Metal Tracks
Caterpillar D7E Dozer w Drawbar 1 24 CCM Diecast Metal Tracks
Paypal   US $429.94
Mantua Tyco Tender Draw Bars 2 parts
Mantua Tyco Tender Draw Bars 2 parts
Paypal   US $3.50
PINTEL HOOK DRAW BAR HITCH TRAILER PINTAL JEEP CJ MB GPW M38
PINTEL HOOK DRAW BAR HITCH TRAILER PINTAL JEEP CJ MB GPW M38
Paypal   US $69.95
WIKING 187 HO MAN DRAW BAR LEBKUCHEN 471
WIKING 187 HO MAN DRAW BAR LEBKUCHEN 471
Paypal   US $11.05
WIKING 187 HO MERCEDES SK DRAW BAR VERPOORTEN 457
WIKING 187 HO MERCEDES SK DRAW BAR VERPOORTEN 457
Paypal   US $11.05
Antique Horse Ox Wood Hand Forged Iron Draw Bar Yoke36 long
Antique Horse Ox Wood Hand Forged Iron Draw Bar Yoke36 long
Paypal   US $15.00
Draw Tite Trailer Reciever Ball Mount Bar Heavy Duty Class IV solid galvanized
Draw Tite Trailer Reciever Ball Mount Bar Heavy Duty Class IV solid galvanized
Paypal   US $19.00
1 Hitch Pin draw bar with clip
1 Hitch Pin draw bar with clip
Paypal   US $6.00
Farmall H Super H Left Side Drawbar Mount Angle
Farmall H Super H Left Side Drawbar Mount Angle
Paypal   US $9.99
2 tow hitch draw bar
2 tow hitch draw bar
Paypal   US $10.00
Fadal part locking drawbar
Fadal part locking drawbar
Paypal   US $150.00
Ford Ferguson IH Three Point Hitch Drawbar Attachment
Ford Ferguson IH Three Point Hitch Drawbar Attachment
Paypal   US $29.00
850 950 JOHN DEERE TRACTOR DRAWBAR BRACKET HOLDER JD 850 950
850 950 JOHN DEERE TRACTOR DRAWBAR BRACKET HOLDER JD 850 950
Paypal   US $14.99
641 860 FORD TRACTOR SWINGING DRAWBAR FORD 600 800 801 601
641 860 FORD TRACTOR SWINGING DRAWBAR FORD 600 800 801 601
Paypal   US $64.14
Lionel 646 2046 2056 Original Rear Trailing Truck Drawbar LOOK
Lionel 646 2046 2056 Original Rear Trailing Truck Drawbar LOOK
Paypal   US $9.99
UNIT RIG CO OIL RIG DRAW WORKS TIE BAR FOB TULSA OKLAHOMA
UNIT RIG CO OIL RIG DRAW WORKS TIE BAR FOB TULSA OKLAHOMA
Paypal   US $9.99
FORD TRACTOR DRAWBAR CHAIN KIT 8N NAA 600 800 801 4000
FORD TRACTOR DRAWBAR CHAIN KIT 8N NAA 600 800 801 4000
Paypal   US $27.95
Old FALLS CITY BEER Display Sign Draw One Gun Holster MINT Louisville bar
Old FALLS CITY BEER Display Sign Draw One Gun Holster MINT Louisville bar
Paypal   US $45.00
Trailer Hitch 14 Extension Bar Adapter Fit 2x2 Receiver
Trailer Hitch 14 Extension Bar Adapter Fit 2x2 Receiver
Paypal   US $39.95
SCHAUBLIN 102 HEADSTOCK FOR W25 COLLETS MANUAL DRAWBAR
SCHAUBLIN 102 HEADSTOCK FOR W25 COLLETS MANUAL DRAWBAR
   US $750.00
FORD TRACTOR ORIGINAL DRAWBAR NAA JUBILEE 800 801 600 601 2000 4000
FORD TRACTOR ORIGINAL DRAWBAR NAA JUBILEE 800 801 600 601 2000 4000
Paypal   US $51.00
Antique Horse Oxen Drawbar Yoke Single Tree Harness
Antique Horse Oxen Drawbar Yoke Single Tree Harness
Paypal   US $28.99
Lionel 2224W prewar cast iron tender with drawbar for 225and 226 loco
Lionel 2224W prewar cast iron tender with drawbar for 225and 226 loco
Paypal   US $61.22
Stihl MS210C 16 Bar for Parts Broken Draw String
Stihl MS210C 16 Bar for Parts Broken Draw String
Paypal   US $46.00
HAMMOND SUZUKI XM 1 DRAWBAR MODULE XM C1 CONTROLLER
HAMMOND SUZUKI XM 1 DRAWBAR MODULE XM C1 CONTROLLER
Paypal   US $500.00
LIONEL 2026 1948 1949 REAR TRUCK DRAWBAR
LIONEL 2026 1948 1949 REAR TRUCK DRAWBAR
Paypal   US $10.00
Reese Tow Power Class III IV w 5 1 4 Drop 4 Rise Draw Bar Ball Mount Chrome
Reese Tow Power Class III IV w 5 1 4 Drop 4 Rise Draw Bar Ball Mount Chrome
Paypal   US $39.95
WIKING 187 MERCEDES DRAWBAR MOBEL KOLB 27459
WIKING 187 MERCEDES DRAWBAR MOBEL KOLB 27459
Paypal   US $7.89
HITCH PIN 7 8 x 6 1 4 CLIP 12pc WHOLESALE DEALER LOT DRAWBAR CAT 1 LIFT ARM EYE
HITCH PIN 7 8 x 6 1 4 CLIP 12pc WHOLESALE DEALER LOT DRAWBAR CAT 1 LIFT ARM EYE
Paypal   US $82.38
HITCH PIN 7 8 x 4 1 4 CLIP 12pc WHOLESALE DEALER LOT DRAWBAR CAT 1 LIFT ARM EYE
HITCH PIN 7 8 x 4 1 4 CLIP 12pc WHOLESALE DEALER LOT DRAWBAR CAT 1 LIFT ARM EYE
Paypal   US $77.90
TRAILER HITCH TRACTOR DRAWBAR THREE POINT KUBOTA NEW h
TRAILER HITCH TRACTOR DRAWBAR THREE POINT KUBOTA NEW h
Paypal   US $89.00
Trailer Hitch 8 Extension Bar Adapter Fit 2x2 Receiver
Trailer Hitch 8 Extension Bar Adapter Fit 2x2 Receiver
Paypal   US $31.95
1pc No3 Morse Taper MT3 With B16 M12 Drawbar Adapter Arbor for Drill Chuck
1pc No3 Morse Taper MT3 With B16 M12 Drawbar Adapter Arbor for Drill Chuck
Paypal   US $16.99
CLASS 1 TRAILER HITCH DRAWBAR
CLASS 1 TRAILER HITCH DRAWBAR
Paypal   US $22.95
NEW Lift All DRAWBAR LOAD TUGGER 12000 lb Rachet strap
NEW Lift All DRAWBAR LOAD TUGGER 12000 lb Rachet strap
Paypal   US $19.99
Pet Trailer Dog Cat Bike Bicycle Trailer Carrier Supplies w Drawbar Hitch Brake
Pet Trailer Dog Cat Bike Bicycle Trailer Carrier Supplies w Drawbar Hitch Brake
Paypal   US $.97
Farmall F20 Tractor RIGHT DRAW BAR MOUNTING BRACKET
Farmall F20 Tractor RIGHT DRAW BAR MOUNTING BRACKET
Paypal   US $9.99
Farmall F20 Tractor LEFT DRAW BAR SUPPORT ARM
Farmall F20 Tractor LEFT DRAW BAR SUPPORT ARM
Paypal   US $9.99
Farmall F20 Tractor LEFT DRAW BAR MOUNTING BRACKET
Farmall F20 Tractor LEFT DRAW BAR MOUNTING BRACKET
Paypal   US $9.99
Farmall F20 Tractor DRAW BAR
Farmall F20 Tractor DRAW BAR
Paypal   US $49.99
Farmall F20 Tractor RIGHT DRAW BAR SUPPORT ARM
Farmall F20 Tractor RIGHT DRAW BAR SUPPORT ARM
Paypal   US $9.99
LION CAR 6 WHEELER DRAWBAR TRAILER CODE 3 SCALE 150
LION CAR 6 WHEELER DRAWBAR TRAILER CODE 3 SCALE 150
Paypal   US $1.56
Farmall Cub swinging drawbar hitch
Farmall Cub swinging drawbar hitch
Paypal   US $115.00
John Deere Tractor Swing Drawbar Pin
John Deere Tractor Swing Drawbar Pin
Paypal   US $2.79
LIONEL 2026 STEAMER EARLY MODELFRONT REAR TRUCK W BRACKETS HDWEDRAWBAR
LIONEL 2026 STEAMER EARLY MODELFRONT REAR TRUCK W BRACKETS HDWEDRAWBAR
Paypal   US $8.95
ANTIQUE HORSE OX YOKE DRAWBAR PRIMITIVE PIONEER FARM TOOL Wood Metal NR
ANTIQUE HORSE OX YOKE DRAWBAR PRIMITIVE PIONEER FARM TOOL Wood Metal NR
Paypal   US $9.95
Drawbar Assembly Consolidation On30 AS SHOWN BACHMANN SPECTRUM 259XX MTB52
Drawbar Assembly Consolidation On30 AS SHOWN BACHMANN SPECTRUM 259XX MTB52
Paypal   US $5.49
TENDER DRAWBAR WITH SCREW  BACHMANN On30 NEW
TENDER DRAWBAR WITH SCREW BACHMANN On30 NEW
Paypal   US $4.39
BERKHIRE HO LOCOMOTIVE MISSING DRAW BAR LOCO TO TENDER COUPLER ON TENDER
BERKHIRE HO LOCOMOTIVE MISSING DRAW BAR LOCO TO TENDER COUPLER ON TENDER
Paypal   US $25.00
JOHN DEERE F930H HYDRAULIC WHEEL DRAWBAR CART DRAWBAR ATTACHMENTS MANUAL
JOHN DEERE F930H HYDRAULIC WHEEL DRAWBAR CART DRAWBAR ATTACHMENTS MANUAL
Paypal   US $6.99
20 Drawbar DB419
20 Drawbar DB419
Paypal   US $19.99
TOW TRACTOR CLARK TUG 5000 LB DRAW BAR
TOW TRACTOR CLARK TUG 5000 LB DRAW BAR
Paypal   US $4,950.00
5C Lever Collect Closer Draw Bar New Never Used
5C Lever Collect Closer Draw Bar New Never Used
Paypal   US $200.00
Blank End Arbors no 3MT Tapped 3 8BSW for Draw Bar 2off
Blank End Arbors no 3MT Tapped 3 8BSW for Draw Bar 2off
Paypal   US $7.89
MASSEY HARRIS TRACTOR DRAWBAR NO RESERVE 396
MASSEY HARRIS TRACTOR DRAWBAR NO RESERVE 396
Paypal   US $.01
2`` Trailer Hitch Drawbar 6 Drop OEM
2`` Trailer Hitch Drawbar 6 Drop OEM
Paypal   US $40.00
LIONEL 2046W 50 TENDER BAR END TRUCKS W DRAWBAR WATER SCOOP
LIONEL 2046W 50 TENDER BAR END TRUCKS W DRAWBAR WATER SCOOP
Paypal   US $9.95
HO BRASS  20 VARIOUS SIZE DRAW BARS  UP by SAMHONGSA
HO BRASS 20 VARIOUS SIZE DRAW BARS UP by SAMHONGSA
Paypal   US $18.50
Kurt Power Drawbar
Kurt Power Drawbar
Paypal   US $51.00
3 WAY ATV HITCH 4 Wheeler ReceiverDrawbar1 7 8 Ball
3 WAY ATV HITCH 4 Wheeler ReceiverDrawbar1 7 8 Ball
Paypal   US $22.99
10MM D Size Lathe Drawbar Tap For Levin Derbyshire Clement etc Lathes
10MM D Size Lathe Drawbar Tap For Levin Derbyshire Clement etc Lathes
Paypal   US $45.00
Farmall Tractor CUB DrawBar W Mount Brackets Original
Farmall Tractor CUB DrawBar W Mount Brackets Original
Paypal   US $36.00
John Deere 2010 drawbar support bracket and pin
John Deere 2010 drawbar support bracket and pin
Paypal   US $9.99
Swinging Drawbar Assembly for Ford and Massey Ferguson
Swinging Drawbar Assembly for Ford and Massey Ferguson
Paypal   US $99.00
Ocean Beach Digital DB 1 Drawbar Controller
Ocean Beach Digital DB 1 Drawbar Controller
Paypal   US $199.00
for Lionel 2026 Rear Truck Drawbar Repair Parts
for Lionel 2026 Rear Truck Drawbar Repair Parts
Paypal   US $14.50
TWO LIFE DRAW BAR BRIDGEPORT MILL PART MILLING MACHINE VARIABLE SPEED
TWO LIFE DRAW BAR BRIDGEPORT MILL PART MILLING MACHINE VARIABLE SPEED
Paypal   US $22.99
DRAW BAR FOR BRIDGEPORT MILL MILLING MACHINE M HEAD
DRAW BAR FOR BRIDGEPORT MILL MILLING MACHINE M HEAD
Paypal   US $64.99
DRAW BAR FOR BRIDGEPORT MILLING MACHINE VARIABLE SPEED
DRAW BAR FOR BRIDGEPORT MILLING MACHINE VARIABLE SPEED
Paypal   US $8.00
DRAW BAR FOR BRIDGEPORT MILL MILLING MACHINE STEP PULLEY
DRAW BAR FOR BRIDGEPORT MILL MILLING MACHINE STEP PULLEY
Paypal   US $7.99
Case 310 Part Number 13103 Drawbar Guide 48 gauge and wider tractors
Case 310 Part Number 13103 Drawbar Guide 48 gauge and wider tractors
Paypal   US $69.99
Ocean Beach Digital Drawbar Controller DB 1 Version 1 Mint Condition
Ocean Beach Digital Drawbar Controller DB 1 Version 1 Mint Condition
Paypal   US $150.00
LATHE 5C COLLETS WITH DRAWL BAR AND RETAINER LATHE COLLET DRAW BAR SET
LATHE 5C COLLETS WITH DRAWL BAR AND RETAINER LATHE COLLET DRAW BAR SET
Paypal   US $49.99
HERPA 187 HO MAN DRAW BAR UNSER BIER KOMMT 818428
HERPA 187 HO MAN DRAW BAR UNSER BIER KOMMT 818428
Paypal   US $7.89
HERPA 187 HO MERCEDES SK DRAW BAR DEUTCHE KLEIDERSPEDITION 811441
HERPA 187 HO MERCEDES SK DRAW BAR DEUTCHE KLEIDERSPEDITION 811441
Paypal   US $7.89
JOHN DEERE H DRAWBAR SUPPORT WITH PIVOT PIN PART AH509R
JOHN DEERE H DRAWBAR SUPPORT WITH PIVOT PIN PART AH509R
Paypal   US $13.95
Antique Cast Iron Wooden Oxen Horse Drawbar Yoke Whippletree Hitch Farm Draught
Antique Cast Iron Wooden Oxen Horse Drawbar Yoke Whippletree Hitch Farm Draught
Paypal   US $29.99
1960 Farmall 560 diesel tractor draw bar plate
1960 Farmall 560 diesel tractor draw bar plate
Paypal   US $9.99
Lionel Parts 2333 2343 F3 Diesel Coupler Drawbar Apron Shield
Lionel Parts 2333 2343 F3 Diesel Coupler Drawbar Apron Shield
Paypal   US $14.99
ORIGINAL LIONEL POSTWAR 2333 2334 2333 60 COUPLER DRAWBAR SHIELD APRON
ORIGINAL LIONEL POSTWAR 2333 2334 2333 60 COUPLER DRAWBAR SHIELD APRON
Paypal   US $9.99
South Bend Heavy 10 Lathe 5c collet draw Bar or Tube
South Bend Heavy 10 Lathe 5c collet draw Bar or Tube
Paypal   US $175.00
PRIMITIVE HORSE OXEN DRAWBAR YOKE SINGLE TREE HARNESS WOOD FARM TOOL
PRIMITIVE HORSE OXEN DRAWBAR YOKE SINGLE TREE HARNESS WOOD FARM TOOL
Paypal   US $24.95
Hammond Organ M100 Pedal Drawbar
Hammond Organ M100 Pedal Drawbar
Paypal   US $9.99
Hammond Organ M2 M3 Pedal Drawbar
Hammond Organ M2 M3 Pedal Drawbar
Paypal   US $9.99
Avery model V tractor draw bar hoop
Avery model V tractor draw bar hoop
Paypal   US $9.99
Avery model V tractor draw bar
Avery model V tractor draw bar
Paypal   US $9.99

Draw Bar

Statistical View of Data in a Clustered Bar Chart

In this article, I shows us how to go about creating a statistical view of data, in the form of a clustered bar chart, using PHP and MySQL.  He provides a real-life scenario, along with accompanying code, to demonstrate how the job can be accomplished.

Statistical view of data in the shape of a clustered bar chart is somewhat similar to having to select between two attributes of a single entity. However, a real-life case scenario is far more complicated. As in most cases, the situation has a lot of entities strongly related with each other through E-R diagrams obeying the normalization rules. Moreover, in such cases, data is not only two-dimensional but, rather, it may be multi-dimensional.

Let's look at the following E-R diagram from which we have to present a statistical view (in the form of a clustered bar chart). How can we do this? This article is an attempt to explain the solution.

Prerequisites

You should have Apache web Server with PHP and MySQL running.  A fair amount of knowledge in PHP is also required. I have provided a zip archive of a demo along with this article.

The database consists of four tables.

  1. Students
  2. Programs
  3. Subjects
  4. Marks

Each of the first three tables has a one-to-many Relationship with the Marks table.

SQL statements to create these tables are as follows:

Marks Table

CREATE TABLE marks (
id int(11) NOT NULL auto_increment,
student_id int(11) DEFAULT '0' NOT NULL,
program int(11) DEFAULT '0' NOT NULL,
subject int(11) DEFAULT '0' NOT NULL,
marks int(11) DEFAULT '0' NOT NULL,
entry_date date,
PRIMARY KEY (id)
);

Programs Table

CREATE TABLE programs (
id int(11) NOT NULL auto_increment,
program varchar(255),
PRIMARY KEY (id),
UNIQUE program (program)
);

Students Table

CREATE TABLE students (
id int(11) NOT NULL auto_increment,
name varchar(100),
PRIMARY KEY (id)
);

Subjects Table

CREATE TABLE subjects (
id int(11) NOT NULL auto_increment,
subject varchar(255),
PRIMARY KEY (id),
UNIQUE subject (subject)
);

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.

The processing PHP code, which is located in the file statistics_action.php in the support file , consists of a function named Collect_Data(....) and three FOR loops as the inputs are appearing from three multi-select web controls and one date control.

From the three multiple controls more than one choice can be made.  The fourth choice would appear from range of date, which is a single choice.

The processing code is organized in such a way that it needs three nested FOR loops.  You can increase or decrease them to add/drop a new dimension.

$dt_from = $sel_year_from . $sel_month_from . $sel_day_from;
$dt_to   = $sel_year_to . $sel_month_to . $sel_day_to;
$dt_valid = "False";
$back = "<a href="" onclick="history.back()">Back</a>";
if ( !(checkdate(intval($sel_month_from) , intval($sel_day_from) , 
$sel_year_from)) )
$msg = "<font color=red>Invalid From Date...</font>";
elseif ( !(checkdate(intval($sel_month_to) , intval($sel_day_to) ,
$sel_year_to)) )
$msg = "<font color=red>Invalid To Date...</font>";
else
{
$msg = formate_date($sel_year_from."-".$sel_month_from."-".$sel_day_from) . " ---- " .
formate_date($sel_year_to."-".$sel_month_to."-".$sel_day_to);
$dt_valid = "True";
}

The block of code above stores the date (from) and date (to) in two global variables (global variables have their visibility accessible inside the user defined funtion).

$dt_valid serves as a flag.  If it is true, then processing proceeds; otherwise, display a relevant message. We have used our checkdate() function, which returns true or false if the passing arguments are wrong dates.

If both dates are correct, then range of the date is stored in the $msg variable.

echo "<table><tr><td  bgcolor=whitesmoke>" . $msg . "..." . $back . "</td></tr></table>";

Next, we initialize three variable for the upper limits of the three nested FOR loops:

$total_counts_student_id = count($sel_id);  
$total_counts_program_id = count($sel_program_id);  
$total_counts_subject_id = count($sel_subject_id);

if ( ($total_counts_student_id > 0) && ($total_counts_program_id > 0) && ($total_counts_subject_id > 0) && ($dt_valid == 'True') ) 
{
echo "<table border=0 cellpadding=0 cellspacing=0 ><caption><h2>Student Marks</h2></caption>";

For each selected Program List from the input form, it will scan each program and subsequent student data:

for ($c=0; $c < $total_counts_program_id; $c++)
{
for ($b=0; $b < $total_counts_subject_id; $b++)
{
// Collection of Data
for ($a=0; $a < $total_counts_student_id; $a++)
{
Collect_Data($sel_id[$a] , $sel_program_id[$c] , $sel_subject_id[$b]);
} // end of the sel_id loop

if ($sum > 0)  // if data found  ...
{   
// Draw Graph            
$total_counts = count($student_data);
for ($i=0; $i < $total_counts; $i++)
{   
$bar_width = multi_factor * ( (100 * $student_data[$i] ) / $sum );     
$bar = ($i % bar_counter)."_bar.gif";  
echo "<tr><td><img src='images/$bar' width=$bar_width  height='10'>   ";
echo number_format($bar_width/multi_factor , 2, '.', '')."%    (".$student_name[$i] . " , " . $program[$i] . " , " . $subject[$i] . ")</td></tr>";    
}
// Display Data in Tabular Format   
echo "<tr><td><table border=1 bordercolor=blue>";
echo "<tr><th>Name</th><th>Program</th><th>Subject</th> <th>Marks</th><th>Date</th></tr>";
for ($i = 0; $i < $total_counts; $i++)
{
echo "<tr><td>" . $student_name[$i] . "</td><td>" . $program[$i] . "</td><td>" . $subject[$i] . "</td>";
if (isset($student_data[$i]) )  echo "<td>" . $student_data[$i] . "</td>";
else                            echo "<td>Not Taken</td>";
echo "<td>" . formate_date($student_dt[$i]) . "</td></tr>";
}
echo "</table></td></tr>";    $x = 0; $sum = 0;  echo "<tr><td><hr></td></tr>"; 
for ($i=0; $i < $total_counts; $i++)  /// purge the array ... better to purge all the arrays.....
{ array_pop($student_data); }

}
} // end of subject_id loop
} // end of program_id loop  

} // end of if

The second-last loop consists of a body with three sections:

  1. The inner-most loop iterates through each student’s name.  It calls the function Collect_Data(..) and stores it in five arrays:    $student_name[], $program[], $subject[], $student_data[], and $student_dt.  It also stores their sum in variable $sum.  From dividing $student_data by $sum, we can calculate the percentage. The width of the image is determined according to this percentile.  Also, an intelligent code is used to draw a new bar each time.  Then, using this data, it draws the bar chart accordingly.
  2. Display the information in tabular format by iterating and retrieving data from the above five arrays.
  3. Third part terminates the table.
  4. This part purges the above five arrays. This is essential in that if array size is smaller in the next iteration, the previous data may be written.

function Collect_Data($a_no , $program_id , $subject_id )
{
global $student_name;
global $program;
global $subject;
global $student_data;
global $student_dt;
global $sum;
global $x;
global $dt_from;
global $dt_to;

The above variables have been declared global so that their values can be accessed outside this user defined function; otherwise, they would become local variables, thus rendering them out of scope.

$query = "select s.name , p.program , sb.subject , m.marks , m.entry_date
from students as s inner join marks as m on s.id = m.student_id
inner join programs as p on m.program = p.id
inner join subjects as sb on sb.id = m.subject
where  s.id = $a_no and p.id = $program_id  and sb.id = $subject_id and m.entry_date >= $dt_from and m.entry_date <=$dt_to " ;

$result = mysql_query($query);

while ($row = mysql_fetch_row($result) )
{
$student_name[$x] = $row[0]; 
$program[$x] = $row[1];
$subject[$x] = $row[2];
$student_data[$x] = $row[3]; 
$student_dt[$x] =  $row[4];

$sum += $row[3];
$x++; // increment the array counter....
}

}  // end of the funciton Collect_Data()....

Our query in this function is extracting data from the four tables through inner-joins.  You can add more tables as per your requirements. The query extracts five values, which have been stored in five global arrays. Here, $x is acting as a counter. Every call to this function may increase its value if a record is found.

Processing time is calculated based on the following code:

function getmicrotime()
{
list($usec,$sec)=explode(" ",microtime());
return ((float)$usec+(float)$sec);
}

$start_time = getmicrotime();
$time_diff = (float)(getmicrotime() - $start_time);
echo "<tr><td colspan=6><i>Processing Time:- " . number_format($time_diff , 3,'.','') . " Seconds</i></td></tr>";

Plotting the clustered bar chart is really simple, even if we have multi-columned information. The logic is organized in a way that it can be easily customized according to the requirements.  I have given an idea how to implement this technique across multiple tables, especially in a tightly normalized database.

About the Author

phpinterviewquestion.com is a interview site , This is for those who want to
Learn about technology, preparation for interview; learn new things in php, .net, javascript, jquery, .htacess, mysql and many more.
phpinterviewquestion.com


!Draw!


!Draw!


$12.99


!Draw!

04021200/10432 - Tractor Draw Bar


04021200/10432 - Tractor Draw Bar


$71.38


[6124440] UPC: 087196042120 38.1L x 3.1W x 1.3H 31.1 LB 0.09 Cubes

04010100/10411 - Tractor Draw Bar


04010100/10411 - Tractor Draw Bar


$38.45


[6120356] UPC: 087196041017 32L x 2.25W x 1H 15.2 LB 0.04 Cubes

Reese Towpower 21793 3.25 Interlock Draw Bar


Reese Towpower 21793 3.25 Interlock Draw Bar


$36.65


2 x 9.5 x 3.25 Draw Bar. 1 Hole Size. 3.25 Drop. 2 Rise. 500/ 5000 lb. Capacity. Does Not Included Hitch Ball.

Reese Towpower 21792 2 Interlock Draw Bar


Reese Towpower 21792 2 Interlock Draw Bar


$33.24


2 x 9 x 2 Draw Bar. 1 Hole Size. 2 Drop.75 Rise. 600/ 6000 lb. Capacity. Does Not Included Hitch Ball.

JET 690235 JTM-1050, Mill with 200S,X TPFA, Draw Bar and Riser Block


JET 690235 JTM-1050, Mill with 200S,X TPFA, Draw Bar and Riser Block


$15189.99


JTM-1050, Mill with 200S,X TPFA, Draw Bar and Riser Block - 690235. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 690274 JTM-1054R, Mill with X-TPFA and Air Power Draw Bar


JET 690274 JTM-1054R, Mill with X-TPFA and Air Power Draw Bar


$15879.99


JTM-1054R, Mill with X-TPFA and Air Power Draw Bar - 690274. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 690009 JTM-4VS, Mill with X and Y Powerfeed, Draw Bar Installed


JET 690009 JTM-4VS, Mill with X and Y Powerfeed, Draw Bar Installed


$11439.99


JTM-4VS, Mill with X and Y Powerfeed, Draw Bar Installed - 690009. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 690193 JTM-4VS, Mill with 200S, X-TPFA and Air Draw Bar


JET 690193 JTM-4VS, Mill with 200S, X-TPFA and Air Draw Bar


$12009.99


JTM-4VS, Mill with 200S, X-TPFA and Air Draw Bar - 690193. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

Into the Draw


Into the Draw


$64.99


Jack Sorenson Into the Draw - Art Print

7006500 - Draw Bar Lock 5/8


7006500 - Draw Bar Lock 5/8


$14.93


[3014602] UPC: 042899700654 6L x 4.38W x 9.63H 3.56 LB 0.15 Cubes

4005903/M834 - 5/16X1/2In Draw Bar Hook


4005903/M834 - 5/16X1/2In Draw Bar Hook


$23.37


[6129324] UPC: 719961462511 16.5L x 12W x 8H 3.22 LB 0.92 Cubes

Draw


Draw


$69.99


David Lozeau Draw - Stretched Canvas Print

JET 690255 JTM-1055, Mill with X-Powerfeed and Air Power Draw Bar Installed


JET 690255 JTM-1055, Mill with X-Powerfeed and Air Power Draw Bar Installed


$16109.99


JTM-1055, Mill with X-Powerfeed and Air Power Draw Bar Installed - 690255. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 691172 JTM-1050, Mill with NEWALL DP700 DRO & Air Power Draw Bar


JET 691172 JTM-1050, Mill with NEWALL DP700 DRO & Air Power Draw Bar


$12259.99


JTM-1050, Mill with NEWALL DP700 DRO & Air Power Draw Bar - 691172. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 691231 JTM-1050EVS/460, Mill with DP700 DRO, X and Y Table Powerfeed with Air Draw Bar


JET 691231 JTM-1050EVS/460, Mill with DP700 DRO, X and Y Table Powerfeed with Air Draw Bar


$17299.99


JTM-1050EVS/460, Mill with DP700 DRO, X and Y Table Powerfeed with Air Draw Bar - 691231. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 690151 JTM-1050, Mill with 200S 3-Q, X and Y TPFA and Air Draw Bar


JET 690151 JTM-1050, Mill with 200S 3-Q, X and Y TPFA and Air Draw Bar


$15679.99


JTM-1050, Mill with 200S 3-Q, X and Y TPFA and Air Draw Bar - 690151. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 690052 JTM-1055R, Mill with VUE DRO, X-TPFA and Air Draw Bar


JET 690052 JTM-1055R, Mill with VUE DRO, X-TPFA and Air Draw Bar


$17359.99


JTM-1055R, Mill with VUE DRO, X-TPFA and Air Draw Bar - 690052. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

JET 690257 JTM-1050EVS/230, Mill with ACU-RITE 200S DRO, X-Axis Powerfeed and Air Power Draw Bar


JET 690257 JTM-1050EVS/230, Mill with ACU-RITE 200S DRO, X-Axis Powerfeed and Air Power Draw Bar


$17299.99


JTM-1050EVS/230, Mill with ACU-RITE 200S DRO, X-Axis Powerfeed and Air Power Draw Bar - 690257. Tolerance Test Sheet Included. One Shot Lubrication System. Way Covers. Draw Bar. Tool Box with Tools

Reese Class II 9'' Draw Bar


Reese Class II 9'' Draw Bar


$27.95


Features: Opening Size: 1.25&quot;&nbsp; x&nbsp; 1.25&quot; Hitch Ball Hole Size: .75&quot; Length: &nbsp; 9&quot; Capacity: &nbsp;3,500/350

Reese Class III & IV 10'' Draw Bar


Reese Class III & IV 10'' Draw Bar


$32.95


Features: Opening Size: 2&quot; x&nbsp; 2&quot; Hitch Ball Hole Size: 1&quot; Length: &nbsp; 10&quot; Rise: 4&quot; Drop: 5.25&quot; Capacity: &nbsp;5,000/500

Draw The Curtains


Draw The Curtains


$9.49


Draw The Curtains

Draw Closer


Draw Closer


$11.49


Draw Closer

Draw Breath


Draw Breath


$12.49


Draw Breath

Draw The Line


Draw The Line


$6.49


Draw The Line

Draw Muhammad


Draw Muhammad


$9.99


Draw Muhammad

Direct Draw Beer Dispenser, 1 Solid/1 Glass Door, Holds Cans


Direct Draw Beer Dispenser, 1 Solid/1 Glass Door, Holds Cans


$2771.21


A True TDB-24-48-1-G-1 Direct Draw Beer Dispenser/Back Bar will keep kegs, bottles of beer, soda, juice, and many other bar necessities right within reach. This 2 door True TDB-24-48-1-G-1 Direct Draw Beer Dispenser/Back Bar has a self-contained refrigerator system and will hold six 1/6 kegs, two 1/2 kegs, or two hundred 12 ounce cans. Constructed to last True Direct Draw Beer Dispensers have stainless steel tops and galvanized interiors with 300 series stainless steel floors. A True Direct Draw Beer Dispenser will always provide frosty cold beverages with a 3 inch insulated column and single faucet draft arm. With a refined design and an attractive black vinyl exterior this True TDB-24-48-1-G-1 Direct Draw Beer Dispenser/Back Bar will suit upscale decor in restaurants and hotels, while adding efficiency during peak service times.

Direct Draw Beer Dispenser, 2 Glass Doors, Holds 245 Cans


Direct Draw Beer Dispenser, 2 Glass Doors, Holds 245 Cans


$2945.63


A True TDB-24-48G Direct Draw Beer Dispenser/Back Bar will keep kegs, bottles of beer, soda, juice, and many other bar necessities right within reach. This glass door True TDB-24-48G Direct Draw Beer Dispenser/Back Bar has a self-contained refrigerator system and will hold six 1/6 kegs, two 1/2 kegs, or two hundred 12 ounce cans. Constructed to last True Direct Draw Beer Dispensers have stainless steel tops and galvanized interiors with 300 series stainless steel floors. A True Direct Draw Beer Dispenser will always provide frosty cold beverages with a 3 inch insulated column and single faucet draft arm. With a refined design and an attractive black vinyl exterior this True TDB-24-48G Direct Draw Beer Dispenser/Back Bar will suit upscale decor in restaurants and hotels, while adding efficiency during peak service times.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

wordpress stat