0

I am trying to update a table column by appending some text to the existing value in the column.

Basically, I am trying to do something like this:

  $wpdb->update('table_name',
                array('notes' => notes + 'some text here to append'))
               ,array('note_id' => 313)
               );

Is this possible?

1 Answer 1

1

Short answer: it's not possible.

Long answer: you should try $wpdb->query instead and write a regular SQL query, something like this:

UPDATE table_name SET notes = CONCAT(notes, 'text to append') WHERE note_id = '313'

Please note it's only an example and you should use $wpdb->prepare to also sanitize variables properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.