Slashes
| From: | Ng Hwee Hwee | Date: | Wed, 10 Dec 2003 02:59:00 +0000 |
| Subject: | Slashes | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-31952@lists.php.net to get a copy of this message | ||
hi all,
i need help on my slashes.. i saw php.net say:
"Do not use addslashes() on strings that have already been escaped with magic_quotes_gpc as
you'll then do double escaping."
with that, i also did not do a stripslashes when i retrieve my data, since my magic_quotes_gpc is
on.. but why is it that I still get a backslash before an occurrence of a single-quote?
for example,
<td width="630" height="6"><? echo $fieldName; ?></td>
where $fieldName is retrieved from the database through:
$query = "select fieldName from table where condition ";
$result = mysql_query($query);
$fieldName = mysql_result($result,0); // which is James' Favourite Pet
also, a more serious problem is when i echo the $fieldName into a textbox.
for example:
<input type="text" name="field1" size="20" value="<? echo
$fieldName; ?>">
if $fieldName contains: it's name is "Bob",
anything after the double quote (i.e. Bob") gets cut-off! it's disaster!!
dear php developers, can you please enlighten me on what happened? and how can I rectify the
problem? thanx so much!
regards,
hwee