Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2009
    Tampa, FL
    Thanked 0 Times in 0 Posts

    PHP mysql Calculations

    I have a php page that I need to do a simple calculation but I cannot figure it out. I have opened the data already to pull info for a form. Now I need to pull one column based on the current user_id and multiply it by as user inputed field. The user table contains the field ret_price and I need to multiply it by rep_pal and the result would be credit.

    I am stuck and need help. Thanks



    $page_limit = 10;

    // filter GET values
    foreach($_GET as $key => $value) {
    $get[$key] = filter($value);

    foreach($_POST as $key => $value) {
    $post[$key] = filter($value);

    $rs_all = mysql_query("select count(*) as total_all from users") or die(mysql_error());

    list($all) = mysql_fetch_row($rs_all);
    $sql="SELECT * FROM users WHERE user_name <> 'admin'";
    $result=mysql_query($sql) or die(mysql_error());


    while ($row=mysql_fetch_array($result)) {

    $options.="<OPTION VALUE=\"$id\">".$thing.'</option>';

    $err = array();

    if($_POST['doPickup'] == 'Enter Pickup')

    if(empty($err)) {
    $total =
    $sql_insert = "INSERT into `pickups`
    (`id`,`date`,`trail_num`,`pal_pu`,`rep_pal`,`ns_pal`, `credit`)
    ('$_POST[id]','$_POST[date]','$_POST[trail_num]','$_POST[pal_pu]','$_POST[rep_pal]','$_POST[ns_pal]') ";

    mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());


    <title>Accounting Main Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="styles.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js">
    <link href="jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css">
    $(function() {
    $( "#datepicker" ).datepicker({ dateFormat: "yy-dd-mm" });

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <td width="74%" valign="top" style="padding: 10px;"><h2><font color="#FF0000">Pickup Entry

    <form name "deliveryform" action="delivery.php" method="post">
    <table width="80%" border="0" align="center" cellpadding="10" cellspacing="0" style="background-color: #E4F8FA;padding: 2px 5px;border: 1px solid #CAE4FF;" >
    <SELECT NAME=id>
    <OPTION VALUE=0>Choose
    </SELECT> </td>
    <td>Date: <input name="date" type="text" id="datepicker" /></td>
    <td>Trailer #:<select name="trail_num" id="trail_num">
    <option selected value=""></option>
    <option value="1986-1">1986-1</option>
    <option value="1986-2">1986-2</option>
    <option value="1986-3">1986-3</option>
    <option value="1986-4">1986-4</option>
    <option value="1986-5">1986-5</option>
    <option value="1986-6">1986-6</option>
    <option value="1986-7">1986-7</option>
    <option value="1986-8">1986-8</option>
    <option value="1986-9">1986-9</option>
    <option value="1986-10">1986-10</option>
    <option value="1986-11">1986-10</option>
    <option value="1986-12">1986-12</option>
    <td>Pallets Picked up <input id="pal_pu" name="pal_pu" type="text" size="8"></td>
    <td>Repairable Pallets: <input id="rep_pal" name="rep_pal" type="text" size="8"> </td>
    <td>Non-Standard Pallets: <input id="ns_pal" name="ns_pal" type="text" size="8"></td>
    <td><input name="doPickup" type="submit" id="doPickup" value="Enter Pickup"></p>



  2. #2
    Senior Coder
    Join Date
    Dec 2005
    Thanked 78 Times in 78 Posts
    and multiply it by as user inputed field
    nothing to do with mysql, this is javascript question.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts