Insert form data into MSSQL database

Home Forums Quform WordPress Insert form data into MSSQL database

This topic is: resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #19309
    devTruong
    Participant

    I am trying to use post process hook to insert data into MSSQL but not successful. What wrong with my code

    function my_post_process_26($form)
    {
    $values = $form->getValues();

    $requestuser = ($value[“iphorm_26_13”] == “- Select -“) ? $value[“iphorm_26_88”] : $value[“iphorm_26_13”];
    $supplier = ($value[“iphorm_26_24”] == “- Select -“) ? $value[“iphorm_26_65”] : $value[“iphorm_26_24”];
    $replace = ($value[“iphorm_26_31”] == “Yes”) ? $value[“iphorm_26_69”] : $value[“iphorm_26_31”];
    $lam = ($value[“iphorm_26_32”] == “- Select -“) ? $value[“iphorm_26_86”] : $value[“iphorm_26_32”];
    $uom = ($value[“iphorm_26_82”] == “- Select -“) ? $value[“iphorm_26_83”] : $value[“iphorm_26_82”];

    $params = array(
    $value[“iphorm_26_3”], //Date Request
    $value[“iphorm_26_4”], //Branch
    $requestuser, //$value[“iphorm_26_13”] Requestedby
    $value[“iphorm_26_18”], //ProtProd
    $value[“iphorm_26_19”], //ProtoCost
    $value[“iphorm_26_71”], //ProdCost
    $value[“iphorm_26_20”], //CC
    $value[“iphorm_26_21”], //Supplier Strike
    $value[“iphorm_26_22”], //Width
    $value[“iphorm_26_23”], //NewItemDesc
    $value[“iphorm_26_25”], //1stOrder
    $value[“iphorm_26_68”], //1stOrderQty
    $supplier,
    $value[“iphorm_26_26”], //Date Required
    $value[“iphorm_26_27”], //Sale Rep
    $value[“iphorm_26_28”], //Cust
    $value[“iphorm_26_29”], //Exclusive
    $value[“iphorm_26_30”], //EstMonthlyUsg
    $replace,
    $lam,
    $value[“iphorm_26_34”], //FinishedGood
    $value[“iphorm_26_89”], //FComments
    $value[“iphorm_26_35”], //SpecialShipping
    $value[“iphorm_26_44”], //MainAccent
    $value[“iphorm_26_37”], //Colors
    $value[“iphorm_26_38”], //TopCoat
    $value[“iphorm_26_39”], //VinylPaperType
    $value[“iphorm_26_70”], //Gauge
    $uom, //Unit of Measure
    $value[“iphorm_26_40”], //Grain
    // $value[“iphorm_26_41”], Gram,
    $value[“iphorm_26_42”], //Scrim
    $value[“iphorm_26_43”], //PBK
    $value[“iphorm_26_45”], //SaleCom
    $value[“iphorm_26_50”], //DesginCom
    $value[“iphorm_26_51”], //QACom
    $value[“iphorm_26_14”], //Edit
    date(“Y-m-d”),
    $value[“iphorm_26_72”], //PartNum
    $value[“iphorm_26_73”], //PONum
    $value[“iphorm_26_74”], //EstDeliveryDate
    $value[“iphorm_26_52”] //CurrentStatCom
    );

    $connectDB = openPatternDB_Connection();
    $queryUpdate = “EXEC sp_UpdateRequestPart “.$_SESSION[“PtnRequestID”].” ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?;”;
    $queryInsert = “EXEC sp_ProcRequestPart ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?;”;

    $queryResult = sqlsrv_query($connectDB,$queryUpdate,$params);
    if($queryResult == false) $queryResult = sqlsrv_query($connectDB,$queryInsert,$params);

    closePatternDB_Connection($connectDB);
    }
    add_action(‘iphorm_post_process_26’, ‘my_post_process_26’);

    #19310
    devTruong
    Participant

    And also It does not send email out to my email either

    #19317
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #19318
    devTruong
    Participant

    Here is the log, It printed out html for the notification email, $values and $params value. And the result when running 2 sp on MSSQL (the last 2 lines). The last 2 lines has nothing, I think the $params, empty for all fields except 1 has value, causes the problem?

    Attachments:
    You must be logged in to view attached files.
    #19322
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #19353
    devTruong
    Participant

    Work great, this can be closed.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy