Announcement

Collapse
No announcement yet.

Problem with an auto Insert

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with an auto Insert

    Hello, I again am, I have a problem with a form, the operation is simple, I have a field where the product code is captured, it searches my database and I want to insert into another table, the problem is that the insert them done twice, I have some screenshots

    form_01.pngform_02.pngform_03.png

    The event is in MyField_onChange

    PHP Code:
    sc_lookup(dataset"SELECT campo1, campo2, campo3
    FROM t_tabla
    WHERE C_CodValv = '{C_CapturarValvula}'"
    );

    // SQL statement parameters
        
    $insert_table  't_historico';  // Table name
        
    $insert_fields = array(   // Field list, add as many as needed
             
    'C_Cliente' => "'{dataset[0][0]}'",
             
    'C_CodValvula' => "'{dataset[0][1]}'",
            
    'C_CodOrden' => "'{dataset[0][2]}'"
         
    );

        
    // Insert record
        
    $insert_sql 'INSERT INTO ' $insert_table
            
    ' ('   implode(', 'array_keys($insert_fields))   . ')'
            
    ' VALUES ('    implode(', 'array_values($insert_fields)) . ')';

        
    sc_exec_sql($insert_sql);

    The problem its only if i do copy/paste on the field
    Thx for the help
    Last edited by reciog.oscar; 12-15-2014, 09:06 PM.
Working...
X