[thelist] simple (?) php question

Nan Smith nansmith at heritageconcord.org
Sat Aug 17 05:23:01 CDT 2002


Duncan,

Single and double quotes have specific functions in databases, so when
using them in text that you are going to store in a db, you have to
escape them, which is done by putting a backslash in front of quotes.
This allows the db to handle them. When you are pulling the text out of
the database field, before you display it, you have to use a function
built in to PHP that removes the slashes:

$text_stored_in_db = stripslashes($text_stored_in_db);

Were you not the person who entered the text into the db? If you need to
know this, the function to add the slashes before you add text with
quotes to the db is:

$text_stored_in_db = addslashes($text_stored_in_db);

Nan

-----Original Message-----

Subject: [thelist] simple (?) php question

The problem is that the pages are sometimes being
rendered in the browser with quotes and other characters
escaped. Here's a small example;

  \'They seemed very, very close\', one witness claimed.\"




More information about the thelist mailing list