www.webdeveloper.com
Results 1 to 3 of 3

Thread: Problem in updating table data

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    Problem in updating table data

    Hi...

    I have table with
    PO_No
    POReq
    CompKg
    PlugWt
    Doz
    KgDoz
    TotalKg
    BatchNeeded

    Now,

    I have problem in updating field (Doz, KgDoz, TotalKg, BatchNeeded).


    here is my code:

    PHP Code:
     $sql "SELECT CompKg, PlugWt, POReq FROM sales_order ";
       
    $res mysql_query($sql$con);
       
      while(
    $row mysql_fetch_assoc($res)){
       
       
    $CompKg $row['CompKg'];
       
    $PlugWt $row['PlugWt'];
       
    $POReq $row['POReq'];
       
       
    $Doz = (($CompKg 1000) / $PlugWt) / 12 2;
       
    $KgDoz = ($CompKg $Doz);
       
    $TotalKg = ($POReq $KgDoz);
       
    $BatchNeeded = ($POReq $Doz);
      } 
       
    $sqlupdate "UPDATE sales_order SET 
       Doz = '
    $Doz',
       KgDoz = '
    $KgDoz',
       TotalKg = '
    $TotalKg',
       BatchNeeded = '
    $BatchNeeded'";
       
    $res_update mysql_query($sqlupdate$con); 
    the result are wrong.

    Thank you

  2. #2
    Join Date
    May 2004
    Location
    chennai, tamil nadu, India
    Posts
    445
    Should you have a WHERE PO_No = ?? clause added ?
    Chris, Senior Developer,
    Php laravel developers,
    www.chrisranjana.com

  3. #3
    Join Date
    Oct 2011
    Posts
    350
    OK thank you.

    Now. I input already the computation inside update and it works

    Thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles