-
Problem saving text to MySQL database from form (help)
I have a form setup that allows me to save
text to a table. But a problem comes up when
I try and save any text that has <> or ' in it.
If I don't use these characters the text saves
fine.
I can also manually save the text in the table
but not from the form. Does anyone know why or
a way to fix this problem?
Thank you!
-
I'm not sure about the angle brackets (I've never had an issue with those), but with single quotes you'll need to double them up before you insert them so that, for instance, "what's up?" becomes "what''s up?". If you happen to be using perl you do something like this:
$text =~ s/\'/\'\'/g;## I use perl so that's my example
-
i'm a newbie.... But I just made a database table on my server. What scripts do i need to add to a form to let it know to send it to the database table and values and all that? And if possible what do i need to make to select the info from the database and post it on a new page when directed?
-
You probably use PHP.
Try this before you execute your query:
add_slashes('$string');
If the information in your string contains signs like ' , they will be stored as \' .
Without something like this your query will be broken by the sign ' because the script will see this as a part of the query instead of information wich is to be stored.
Hope this helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|