Skip to content

Escaping Strings with Single Quotes #4

@mphasize

Description

@mphasize

Hi,

I'm using this php client and I want to insert some new data records into my CartoDB table which contain single-quotes. I have seen, that the classes don't provide any solutions for this yet, so I'm trying to work out my own escaping solution.

As discussed here, a simple Backspace-Escape should work for single quotes (and from what I know this usually works fine):
http://support.cartodb.com/discussions/problems/50-problem-with-apostrophe

But something seems to get messed up anyway and I just get a syntax error.

Here's the query I'm passing to the runSql Function:

INSERT INTO handel_v2 (the_geom,crm_id,firma) VALUES(GEOMETRYFROMTEXT('POINT(3.7941725 41.9231994)', 4326),'internal ID','Name with' single-quote');
SELECT handel_v2.cartodb_id as id, handel_v2.* FROM handel_v2 WHERE cartodb_id = currval('public.handel_v2_cartodb_id_seq');

Any Ideas? (Anything else I can provide to track this down?)
Thanks!
M

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions