|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2002-07-31 11:30 UTC] rasmus@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
script example: <?php $SQL = "INSERT INTO Table SET Field = '"; $Recordset = mysql_query("SELECT Field FROM Table", $Link); //we assume that the string in Field contains a caracter //that needs a \ while($Record = mysql_fetch_array($Recordset)) { //This string contains \ under Linux/apache //and works mysql_query($SQL.$Record["Field"]."'", $Link); //This string doesn't have \ under Windows //and doesn't works (produce an error) mysql_query($SQL.$Record["Field"]."'", $Link); } The problem can be fix by adding: ... addslashes(stripslashes($Record["Field"])) ... So, under Windows, we simply stripslashes() nothing (because there is no \) and under Linux/Apache we stripslashes() all characters that needs to be slashed. Finally, in the 2 cases, we need to addslashes(). (if we don't uses stripslashes(), we will double the \ under Linux/Apache). Jacques B?rard papejack@hotmail.com