Results 1 to 2 of 2

Thread: help with SUM()

  1. #1
    Join Date
    Jul 2008
    Posts
    4

    Unanswered: help with SUM()

    I'm creating something small for reps to follow up on sales.

    can somebody help me out with this

    Quote:
    $com = SUM($amount*0.25);

    $qry = "INSERT INTO data (date, rep, client, amount, com, status) VALUES ('$postdate', '$rep', '$client', '$amount', '$com', 'pending')";
    $result = mysql_query($qry);
    if($result) {
    header("location: success.php");
    exit();
    }else {
    die("Query failed");
    }
    the problem is $com commision on sales.

    __________________
    Links removed - pootle flump
    Last edited by pootle flump; 07-23-08 at 08:23.

  2. #2
    Join Date
    May 2008
    Posts
    10
    Quote Originally Posted by sujith.it
    I'm creating something small for reps to follow up on sales.

    can somebody help me out with this

    Quote:
    $com = SUM($amount*0.25);

    $qry = "INSERT INTO data (date, rep, client, amount, com, status) VALUES ('$postdate', '$rep', '$client', '$amount', '$com', 'pending')";
    $result = mysql_query($qry);
    if($result) {
    header("location: success.php");
    exit();
    }else {
    die("Query failed");
    }
    the problem is $com commision on sales.

    __________________
    renter insurance california bedroom furniture

    Well I'd need you to provide the whole code for a good idea of the problem.

    If the problem is in the $com, it must be $amount or sum() that is the problem.

    I would write it like this:

    $com=$amount*0.25;

    instead of:

    $com=SUM($amount*0.25);

    I just never use the sum personally, but it doesn't look like it's a problem.

    effectivly, you're trying to divide the price by 4? or 25% of the actual price?

    Maybe explain more and I might be able to help

Posting Permissions

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