This topic is locked
[SOLVED]

 Apostrophe write causes error

10/12/2013 5:05:01 PM
PHPRunner General questions
G
gdude66 author

I am trying to write a name on update to a table from phprunner runner.

When it tries to write an error occurs. Is there a way without having to use magic quotes that will write the value without causing an error?

I am trying to get it to write O'conner but the apostrophe causes the error.

G
gdmacdo 10/13/2013

I had this problem with email addresses. I needed to use the email in a session variable but some of the email addresses had apostrophes. After successful login I used:
**
[font="Courier New"]$_SESSION["Teacher_Email"]=$value_Email;**

Admin 10/13/2013
G
gdude66 author 10/13/2013



Use addslashes() function:

http://php.net/manual/en/function.addslashes.php



Thanks

Where would I put this if say a field called username already populated from the database needed to be written to another table in the field user and that caused the error?

Admin 10/13/2013

What is your current code? Simply enclose the value of username field in addslashes() unction call.

G
gdude66 author 10/13/2013



What is your current code? Simply enclose the value of username field in addslashes() unction call.



Thanks for your reply

Is this as an event or in visual editor because I don't have any code there.

It calls the name of the person on load (this one has an apostrophe) and when it tries to write the name O'Conner back it comes up with error 256.

The field is called email and in visual editor is a textbox with @$_SESSION[$strTableName."_masterkey1"]as both default and update value.
So I don't really know where to put the addslashes code or specifically what to write.

Admin 10/13/2013

Just doesn't make any sense. If there is no code, how it can try to write something to the database?

G
gdude66 author 10/13/2013



Just doesn't make any sense. If there is no code, how it can try to write something to the database?



I am using the default add page from phprunner.

Select the workshop then it should write the email address and workshop name to a table in the db. Works for every other user.

Admin 10/13/2013

As a first step make sure you use the latest available build for the version of PHPRunner you use.
If this doesn't help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.
Make sure to supply instructions on reproducing the issue.