mosDBTable Question - Please help!

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
muptaface
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Mar 07, 2007 10:33 pm

mosDBTable Question - Please help!

Post by muptaface » Mon Dec 03, 2007 5:46 pm

I have a class that inherits from mosDBtable, I am using it to store() data which comes from form fields.  Everything works fine unless there is an apostrophe entered in the form.  In that case, it appears that a backslash is inserted before the apostrophe in the database.  So if the user enters "It's" it becomes "It\'s".  I understand that this is probably intended as an escape character, but then why is it getting into the database?  Shouldn't it just escape out, leaving the apostrophe itself in the database?

I suspect that for some reason, the string is being "escaped" twice.  So if it starts as "It's", it then becomes "It\'s" which is properly escaped, then "It\\\'s" which is the escaped version of the escaped string, protecting the original backslash as it moves into the database.  But I could be wrong about that.

Thanks in advance.

Post Reply