...

View Full Version : Error uploading to database with ' character



nickyfraggle
11-16-2006, 04:02 PM
Hello,

I am using a HTML form which posts values to a php script which then writes these values to a database. However, whenever a user inputs the ' character, it errors and won't allow me to upload the text.

What can I do to solve this?

Thank you,

Nicky

Snetty
11-16-2006, 04:11 PM
addslashes() is your friend

nickyfraggle
11-16-2006, 04:14 PM
will this also output it or does it merely use them / to allow it to get into the database?

also...where would I insert it in my query string?

thanks for your help!

nicky

nickyfraggle
11-16-2006, 04:16 PM
$string = addslashes($string);

it's ok...i think i've found the answer to part of my own question :-)

UberDragon
11-16-2006, 04:51 PM
$string = addslashes($string);

it's ok...i think i've found the answer to part of my own question :-)

If you are using a mySQL database I would take a look at:

http://www.php.net/manual/en/function.mysql-real-escape-string.php

~UberDragon

Alex!
11-16-2006, 04:58 PM
just don't forget to use stripslashes() when u get the data from the database ;)

Alex:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum