ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Modifying Database data with Regex - error when returning data to Database

October 31, 2008 8:35am

Subscribe [0]
  • #1 / Oct 31, 2008 8:35am

    saul

    6 posts

    I know I’ll kick myself when I see the answer to this -

    I have a Weblog with several 1000 articles I need to make several changes to all of them and I cooked up a simple
    regex to do that, dropped it into a standalone php page that queried the db

    $sql = “SELECT * FROM `exp_weblog_data` WHERE `weblog_id` = 2 AND `entry_id` = $id”. ’ LIMIT 0, 1’;

    that works well, I make my simple change (say I’m changing ‘Blue’ to ‘Red’)
    and I post the revised data back to the DB

    $query=“UPDATE exp_weblog_data SET field_id_3=’$updated_data’ WHERE entry_id=’$data_id’”;

    also works but in the process any special characters like ’ ” etc. go FUBAR - what step am I missing? I know it’s obvious, but clearly not to me.

    TIA
    saul

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases