This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

encoding text for use in mysql table

Old posts that have not been replied to for several years.
Locked
d
diarmuid

encoding text for use in mysql table

Post by diarmuid »

i've run into a problem when trying to insert data to a mysql table.

for example: when i try to insert a variable who's value is "because you're cool', it'll return an error saying my sql syntax is wrong because of the [b]'[/b] in "you're"

what i've been looking for is a script, or snippet, that will place \'s infront of all characters that will cause problems with mysql.

also, i need one that'll do the opposite, when i read data from a mysql table, that has been processed by the above script, i need a second script to remove any "\" that was inserted from the first script..

hopefully you all followed this :)

thanks,
Chad.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

If you are using mysqltcl, use the 'mysqlescape' command...
You should consult the docs for the mysqltcl extension before asking such questions though..
Locked