note 56428 deleted from function.str-replace by bjori
| From: | bjori@php.net | Date: | Sun, 26 Mar 2006 22:21:58 +0000 |
| Subject: | note 56428 deleted from function.str-replace by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106667@lists.php.net to get a copy of this message | ||
Note Submitter: dominicshaw at hotmail dot com
----
I have been trying to make a single quote be sent through to my database backend, but even when I
replace the single quote with two single quotes, it wouldn't work properly.
After some fiddling I made this code:
$strSQL = $strSQL.'spAppTitle = "'.str_replace("'",
"''", $strAppTitle).'"';
$strSQL = str_replace("\\", "", $strSQL);
$q_ud = mysql_query($strSQL) or die("SQL Error: <p>SQL:
$strSQL</p>".mysql_error());
Which allows me to send values to the database with a single quote, with no backpaces infront of it.
Hope this helps someone.