UK SEO ForumsCalendarContact Us

Go Back   UK SEO Forums > Webmaster > Programming
Register FAQ Links Dir Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2009, 03:32 AM
sifanyroma sifanyroma is offline
SEO Baby
 
Join Date: Jul 2009
Posts: 3
iTrader: 0
sifanyroma is on a distinguished road
how to SUM output of certain field result

i got 3 combo box for choose driver,vehicleno and month.

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 : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbspriver $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);
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT +1. The time now is 11:30 PM.
vBSkinworks

UK SEO