Announcement

Collapse
No announcement yet.

Control App to update another table

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

  • Control App to update another table

    Hi,

    I am trying to create a control application to update same fields in a mysql table. I keep getting this error:

    Code:
    Error while accessing the database:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Between 79090200 AND 79090211 '' at line 1
    Here is the code that runs on validate:
    Code:
    /**
     * Update a record on another table
     */
    
    // SQL statement parameters
    $update_table  = 'awb';      // Table name
    $update_where  = "no 'Between {from} AND {to}'"; // Where clause
    $update_fields = array(   // Field list, add as many as needed
         "status = 'I'",
         "aid = '{agent}'",
     );
    
    // Update record
    $update_sql = 'UPDATE ' . $update_table
        . ' SET '   . implode(', ', $update_fields)
        . ' WHERE ' . $update_where;
    sc_exec_sql($update_sql);
    I tried to run the query with sc_exec_sql but that didnt work either.

    Any help on what Im doing wrong would be much appreciated. Thanks

  • #2
    I think you need to delete the , in "aid = '{agent}'",
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Hi,
      you also have to change your WHERE clause:

      $update_where = "no Between {from} AND {to}"; // too many quotation marks

      jsb

      Comment


      • #4
        Thank you guys so much. Fresh eyes always help!

        Comment

        Working...
        X