Loading ...
Sorry, an error occurred while loading the content.
 

Re: [phpXperts] Need Help with MYSQL Calculated data insert

Expand Messages
  • Guru™
    I am using simple insert into database query. $con = mysql_connect( localhost , root , ); if (!$con) { die( Could not connect: . mysql_error()); }
    Message 1 of 4 , Nov 22, 2011
      I am using simple insert into database query.

      $con = mysql_connect("localhost","root","");
      if (!$con)
        {
        die('Could not connect: ' . mysql_error());
        }

      mysql_select_db("sale_vat", $con);

      $sql="INSERT INTO vat(mwool40, mwool40_qty, mwool40_utp, mwool40_val)
      VALUES
      ('$_POST[mwool40]',,'$_POST[mwool40_qty]', '$_POST[mwool40_utp]', '$_POST[mwool40_val]')";

      mwool40, mwool40_qty & mwool40_utp is working fine but its unable to insert the calculated value of "mwool40_val" into the database. Please help me with it.



      On Tue, Nov 22, 2011 at 2:45 PM, abdullah al jahid <abdullah.al.jahid@...> wrote:
       

      Please write the query you are using.



      2011/11/22 Guru™ <nagendra802000@...>
       

      Hi All,

      I have few products, quantity and its unit price. Now I am able to insert the data into the database apart from the calculated one. For example:

      $mwool40_qty = 2

      $mwool40_utp  = 50

      $mwool40_val = $mwool40_qty*$mwool40_utp ;

      Now I can see the quantity and unit price in the database but I can't able to insert the value of $mwool40_val after the calculation. Although I can echo out and its showing the correct value. Please Help me with this.
      --
      Best,

      Guru™




      --
      Best Regards
      Abdullah Al Jahid





      --
      Best,
      Guru™

    • Arif Mahmud Rana
      Hello Guru, First look your query if you correctly putting value, if you are using simple concatenation(using than dot or coma etc) or variable
      Message 2 of 4 , Nov 22, 2011
        Hello Guru,

        First look your query if you correctly putting value, if you are using simple concatenation(using ' than dot or coma etc) or variable interpolation("{$var}" etc) if the problem persists than dump your query follow step by step procedure isolate the problem. Hope problem will be solved.

        ARIF MAHMUD RANA
        software engineer at infolink

        From: Guru™ <nagendra802000@...>
        To: phpexperts@yahoogroups.com
        Sent: Tuesday, November 22, 2011 2:59 PM
        Subject: [phpXperts] Need Help with MYSQL Calculated data insert

         
        Hi All,

        I have few products, quantity and its unit price. Now I am able to insert the data into the database apart from the calculated one. For example:

        $mwool40_qty = 2

        $mwool40_utp  = 50

        $mwool40_val = $mwool40_qty*$mwool40_utp ;

        Now I can see the quantity and unit price in the database but I can't able to insert the value of $mwool40_val after the calculation. Although I can echo out and its showing the correct value. Please Help me with this.
        --
        Best,
        Guru™



      Your message has been successfully submitted and would be delivered to recipients shortly.