How to insert a value with single quote into item field via podio api




  • Andreas Haugstrup Pedersen

    Can you share your actual code? This should work.


    Comment actions Permalink
  • ehub workspace

    Hi Andreas,

    I have attached my actual code. I have use the below:



    Before using either mysql_real_escape_string or addslashes, as long there is a single quote like the below, it will not create or update the item on podio app.


    These's are my shoes


    But if i use either mysql_real_escape_string or addslashes, it will be able to create and update the item on the app but i will see a forward slashes before all my single quote.

    Please advice


    Comment actions Permalink
  • Andreas Haugstrup Pedersen


    I didn't review your code since it's 2500 lines and that would take quite some time. I instead made sure that things work on our end. You can test yourself with this minimal example that updates the value of a text field to one that contains a single quote:

    $item_id = 1234; // Replace with a real item id

    $field_external_id = 'title'; // Replace with external_id of text field on item

    $item = PodioItem::get_basic($item_id);

    $item->field($field_external_id)->set_value("My new value's value");


    This will correctly update the field's value to a string containing a single quote. My guess would be that you have a problem somewhere else in those 2500 lines which results in the string being different than what you think it is.

    You can kick podio-php into a debug mode which will log all API requests for you. That's a good way to make sure you are sending the data you think you are sending. Details:


    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk