Hi;
I have tried looking for the answer but I can't seem to get it...so here is my problem.
I have a script to price up the cost of a boat. The user selects what options they want and the form is sent to another page where it is displayed. I can get the information to display correctly, but I am at a loss how to bridge the tables together and display a SUM total of the options selected. (In this case a boat type, and engine type. Any ideas how to get my SUM and Fetch it out?
<?
session_start();
$whatboat=$POST["whatboat"];
$whatengine=$POST["whatengine"];
$connection = mysql_connect('localhost', ***, *****) or die(mysql_error());
mysql_select_db(**, $connection) or die(mysql_error());
//Let's display the chosen boat
$sql = "SELECT * FROM boat WHERE boat = '$whatboat'";
$result = mysql_query($sql)
or die('Yo boat query be broke, fool!');
//determine the number of rows you returned
$num_rows = mysql_num_rows($result);
//loop through each row
for($i = 0; $i < $num_rows; $i++)
{
$row = mysql_fetch_object($result);
//These are our fields
echo("$row->boat $row->price<br><br>");
}
//Let's display the chosen engine
$sql = "SELECT * FROM engine WHERE engine = '$whatengine'";
$result = mysql_query($sql)
or die('Yo engine query be broke, fool!');
//determine the number of rows you returned
$num_rows = mysql_num_rows($result);
//loop through each row
for($i = 0; $i < $num_rows; $i++)
{
$row = mysql_fetch_object($result);
//These are our fields
echo("$row->engine $row->price");
}
?>
That's what I have, it works but its bits and pieces of other scripts I have played with.
Any help would be welcomed.
Regards;
Hogwan
www.cybernamez.com