This topic is locked

single quote causing problem to insert (no event codes)

10/16/2007 9:26:16 AM
PHPRunner General questions
A
acpan author

Hi,
my table:
name

birthday

remark
Used phprunner 4.1 to generate the form. When user enters

in remark exmaple:
Father's day
When user clicks save on the form, it caused error.
This seems a common db+php issues, is there a way to get around it ?

I read other post using db_addslashes on event codes but

There is no way i can change the SQL since it's inserted by

the phprunner generated form - no event code.
Thanks for any advice.
Dex

Alexey admin 10/16/2007

Dex,
what is the error message you get ?
PHPRunner works fine with quotes in field names and values.

A
acpan author 10/16/2007

Hi Alexey,
Thanks for pointing me to the right direction. Your question was crucial for me to

narrow down to the right path and my problem was solved:

  1. Phprunner inserted Text such as: "Mother's Day" filled in by user.
  2. Another background process failed when trying to read the table with entries

    contain single quote but OK for entry without. So it was thought that forms created by PHPRunner did not insert the

    data properly as the other process was running well and exsited before using PHPrunner to generate the web pages.
  3. Error was the background process having SQL as follows:
    Read table into %variable% then

    INSERT INTO another_table SET remark = '%Variable%' => This failed.

    INSERT INTO another_table SET remark = "%Variable%" => This was ok as i supposed the contents has single quote,

    and with open and end single quotes, it is confused.
    I think this may be a common situation for us to use ' and " interchangeably (at least for me) to quote string.

    This scenario caused it to fail.
  4. There is no problem with Phprunner handling text with single quotes input by user on its generated forms.
    Thanks for your fast response.
    Dex