www.webdeveloper.com
Results 1 to 3 of 3

Thread: sqlite and quotes within field values

  1. #1
    Join Date
    Oct 2005
    Location
    California
    Posts
    603

    sqlite and quotes within field values

    PHP Code:
    tep_db_query"insert into " TABLE_CONFIGURATION 
       (
         configuration_title, 
         configuration_key, 
         configuration_value, 
         configuration_description, 
         configuration_group_id, 
         sort_order, 
         set_function, 
         date_added
       )values (
         'Enable Authorize.net Module', 
         'MODULE_PAYMENT_AUTHORIZENET_STATUS', 
         'True', 
         'Do you want to accept Authorize.net payments?', 
         '6', 
         '0', 
         'tep_cfg_select_option(array(\'True\', \'False\'), ', 
         datetime(\'now\')
       )"
    ); 
    Sqlite doesn't like th escaped single quotes. addslashes doesn't seem to work either. How do I go about this?
    Last edited by sitehatchery; 02-07-2007 at 04:48 PM.

  2. #2
    Join Date
    Oct 2005
    Location
    California
    Posts
    603
    Ok, I think I got the answer here:
    http://www.sqlite.org/faq.html#q16

  3. #3
    Join Date
    Oct 2005
    Location
    California
    Posts
    603
    Excellent, it looks like mysql can accept two single quotes together as well.

    for instance,
    PHP Code:
    $result="insert into products values title="can''t say more"; 
    inserting strings with single quotes in this way makes the insert statement compatible with mysql and sqlite - haven't tested anything else. Of the two database-types, if you escape single quotes with a backslash, it's only compatible with mysql.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles