how to SUM output of certain field result
OUTPUT
id date driver vehicleno drop
3 2005-06-06 sugu 3411 7
9 2007-01-25 sugu 3411 55
10 2007-01-15 sugu 3411 9
11 0000-00-00 sugu 3411 5
i want to SUM the output of this DROP field result. my coding is below, please someone can help me to find solution for this problem. My coding is below...please advise where to add in the fomula / coding.
index.php
<div align="left">
<p><img src="logo.gif" width="78" height="78">
</p>
<?php
// get variable after selecting something from the dropdown with name 'chooser'
$select = $_POST['select'];
// if something has been chosen
if (!empty($select)) {
// get the chosen value
$chooser = $_POST['chooser'];
$chooser2 = $_POST['chooser2'];
$chooser3 = $_POST['chooser3'];
// do whatever u want with that value
// for example output it
print "<B>Displaying Records for : &n bsp; &nbs p; Driver $chooser</B><P>";
print "Vehicle No: $chooser2 <br>";
print "Month : $chooser3 <P>";
}
$db="b31_209797_pamross";
$link = mysql_connect("","","");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "select * from dt_tb where driver='$chooser' and vehicleno='$chooser2' and month(startdate) between '$chooser3' and '$chooser3' " )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=800 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
-
willmartinapj -
Thanks
{{ DiscussionBoard.errors[939147].message }} -
-
GB2008 -
Thanks
SignatureGary Bailey{{ DiscussionBoard.errors[946462].message }} -