Results 1 to 2 of 2

Thread: Database insert apostrophe problem

  1. #1
    User
    Join Date
    11-24-13.
    Posts
    44

    Default Database insert apostrophe problem

    I'm developing an extension for importing news from a csv file.
    When I make the insert into the db, the string that contains the teaser is interrupted in corrispondence of the first apostrophe character.
    I made the insert like that:
    PHP Code:
    $this->Database
                
    ->prepare("INSERT INTO tl_news %s")
                ->
    set(array('teaser' => $myTeaser))
                ->
    execute() 
    How can I escape a string in contao with its database astraction?
    Last edited by DavideR; 06/30/2016 at 11:08.

  2. #2
    User
    Join Date
    11-24-13.
    Posts
    44

    Default

    Quote Originally Posted by DavideR View Post
    I'm developing an extension for importing news from a csv file.
    When I make the insert into the db, the string that contains the teaser is interrupted in corrispondence of the first apostrophe character.
    I made the insert like that:
    PHP Code:
    $this->Database
                
    ->prepare("INSERT INTO tl_news %s")
                ->
    set(array('teaser' => $myTeaser))
                ->
    execute() 
    How can I escape a string in contao with its database astraction?
    Solved: the csv source file had wrong encoding. Saving it in utf8 solved the problem.

Bookmarks

Posting Permissions

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