Php Script To Make Calculation With Data Retrieved From Mysql

Discussion in 'PHP' started by TKB, Nov 24, 2006.

  1. #1
    Does anybody know where I can find scripts with calculations from different fields and tables in order to show the total price?
    Below is my script page placeorder.php.

    Thank you in advance for your effort.

    <?php
    $conn = mysql_connect('localhost','koula,'987037')
    or die('Could not connect: ' . mysql_error());
    echo '<!--Connection ok-->';
    mysql_select_db('koulos') or die('Select DB error');
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Asbestos</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    <!--
    a:hover {
    color: #000000;
    }
    body {
    background-color: #66CCFF;
    }
    .style2 {
    color: #FFFFFF;
    font-style: italic;
    }
    .style3 {color: #FFFFFF}
    .style4 {
    color: #3300CC;
    font-weight: bold;
    font-style: italic;
    }
    -->
    </style>
    </head>

    <body>

    <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr bgcolor="#003399">
    <td width="100" height="100" align="center">&nbsp;</td>
    <td height="100"><p align="center"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="+2"><strong>E-Asbestos Pty.Ltd.</strong></font></p>
    <p align="center"><img src="images/images.jpg" alt="" name="logo" width="136" height="135" id="logo" />
    </p>
    <p align="center"><strong></strong></p>
    <p align="center" class="style2">An ISO9002 Certified Company</p></td>
    <td width="30" height="100">&nbsp;</td>
    </tr>
    <tr bgcolor="#000033">
    <td width="100" height="5"><img src="/images/spacer.gif" width="100" height="5"></td>
    <td height="5"><img src="/images/spacer.gif" width="100" height="5"></td>
    <td width="30" height="5"><img src="/images/spacer.gif" width="30" height="5"></td>
    </tr>
    <tr>
    <td width="100" bgcolor="#990000"><table width="93" border="1">
    <tr>
    <td width="153" align="left" valign="middle"><div align="center"><a href="Index.htm"><img src="images/HOME2a.gif" width="75" height="40" border="0" align="middle" /></a></div></td>
    </tr>
    <tr>
    <td align="left" valign="middle"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="93" height="33">
    <param name="BGCOLOR" value="#990000" />
    <param name="movie" value="placeorder.swf" />
    <param name="quality" value="high" />
    <embed src="placeorder.swf" width="93" height="33" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#990000" ></embed>
    </object></td>
    </tr>
    <tr>
    <td align="left" valign="middle"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="93" height="33">
    <param name="movie" value="checking.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#990000" />
    <embed src="checking.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="93" height="33" bgcolor="#990000"></embed>
    </object></td>
    </tr>
    <tr>
    <td align="left" valign="middle"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="93" height="33">
    <param name="movie" value="Sign.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#990000" />
    <embed src="Sign.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="93" height="33" bgcolor="#990000"></embed>
    </object></td>
    </tr>
    </table></td>
    <td valign="top" class="text">
    <table width="100%" height="270" border="0" cellspacing="0" cellpadding="20">
    <tr>
    <td class="text"><div align="center"><em><strong>&lt;&lt; </strong></em><span class="style4">Purchase Order Form</span> <em><strong>&gt;&gt;</strong></em>
    </div>
    <form name="form1" id="form1" method="post" action="">
    <table width="585" border="2" cellpadding="5" cellspacing="15" bgcolor="#DDDDDD">
    <tr>
    <td width="173">Category Name : </td>
    <td width="339">

    <?php
    $query = "SELECT * FROM categories";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    ?>


    <select name="categoryname" id="categoryname">
    <?php
    while ($line = mysql_fetch_array($result, MYSQL_NUM))
    {
    echo "<option value=\"".$line[0]."\"> ".$line[1]." </option>" ;
    }
    mysql_free_result($result);
    ?>
    </select></td>
    </tr>
    <tr>
    <td>Insucance:</td>
    <td>

    <?php
    $query = "SELECT * FROM insurancecharges";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    ?>

    <select name="InsuranceType" id="InsuranceType">

    <?php
    while ($line = mysql_fetch_array($result, MYSQL_NUM))
    {
    echo "<option value=\"".$line[0]."\"> ".$line[1]." </option>" ;
    }
    mysql_free_result($result);
    ?>

    </select></td>
    </tr>
    <tr>
    <td>Packaging Type : </td>
    <td>
    <p>

    <?php
    $query = "SELECT PackagingDescription,PackagingType FROM packaging ";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    ?>
    <select name="PackagingType" id="PackagingType">
    <?php
    while ($line = mysql_fetch_array($result, MYSQL_NUM))
    {
    echo "<option value=\"".$line[0]."\"> ".$line[1]." </option>" ;
    }
    mysql_free_result($result);
    ?>
    </select>
    </p>
    </td>
    </tr>
    </table>
    </form>
    <form name="form2" id="form2" method="post" action="">
    <table width="589" border="1" cellpadding="5" cellspacing="15" bgcolor="#DDDDDD">
    <tr>

    <td>Product Units:</td>
    <td>
    <?php
    mysql_query ("INSERT INTO products (ProductUnits)
    VALUES
    ('$_POST[ProductUnits]')");
    ?>

    <input name="ProductUnits" type="text" id="ProductUnits" /></td>
    </tr>
    <tr>
    <td>Kilometer Distance:</td>
    <td>
    <?php

    mysql_query ("INSERT INTO transportationcharges (TransportationUnit)
    VALUES
    ('$_POST[TransportationUnit]')");
    ?>

    <input name="TransportationUnit" type="text" id="TransportationUnit" /></td>
    </tr>
    <tr>
    <td>Total Price: </td>
    <td>&nbsp;</td>
    </tr>
    </table>
    <br />
    <input type="submit" name="Submit" value="Submit" />
    <input name="Reset" type="reset" id="Reset" value="Reset" />
    </form> <br />
    <blockquote>

    </blockquote> <p>&nbsp;</p> </td>
    </tr>
    </table>
    </td>
    <td width="30" bgcolor="#990000">&nbsp;</td>
    </tr>
    <tr bgcolor="#000033">
    <td height="5"><img src="/images/spacer.gif" width="100" height="5"></td>
    <td height="5"><img src="/images/spacer.gif" width="100" height="5"></td>
    <td height="5"><img src="/images/spacer.gif" width="30" height="5"></td>
    </tr>
    <tr bgcolor="#003399">
    <td width="100" height="30">&nbsp;</td>
    <td height="30"><div align="center" class="style3">&copy; Copyright 2006 - 2007 E-Asbestos Pty. Ltd. All Rights Reserved.<br />
    Site designed and maintained by www.adtb.com </div></td>
    <td width="30" height="30">&nbsp;</td>
    </tr>
    </table>


    <p align="center">&nbsp; </p>
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <p align="left"><em></em></p>
    <p align="center"><em></em></p>
    <blockquote>
    <p>&nbsp;</p>
    </blockquote>
    <ul><p>&nbsp;</p>
    </ul>
    </body>
    </html>
     
    TKB, Nov 24, 2006 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you could just post your table structure (where do you get the prices from) I might be able to help.
     
    maiahost, Nov 24, 2006 IP
  3. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #3
    OMG ... do you know what you're doing here?
     
    falcondriver, Nov 24, 2006 IP