PHP 5.4 on IIS is adding slashes after quote automatically
My company recently switched to PHP. We have had no real issues until today. When I assign an string that has quotes inside it to a variable, the string will have slashes escaping the single quotes.
This is a one week old fresh install of 5.4. I read that 5.4 does not have magic quotes. I searched the php.ini and did not find anything with magic in the name, so it must not be on.
Example:
$sql = "Select Description from value where [Group]='auto_email_test'";
echo dbStr($sql, "0");
When I debug, the $sql will be
"Select Description from value where [Group]='auto_email_test'";
Tried with no luck.
$sql = "Select Description from value where [Group]='auto_email_test'";
echo dbStr(stripslashes($sql), "0");
Why is php escaping my quotes right away? And why does stripslashes() not work to remove them?
EDIT: To Show dbStr();
/**
*
* Executes the $ImcomingSql query and returns the first cell in the first row
*
* @param string $_IncomingSql The sql query that you want to execute.
* @param string $_DefaultValue The value to return if null.
*/
function dbStr($_IncomingSql, $_DefaultValue) {
$Result = Query(Conn, $_IncomingSql);
if ($Result !=0)
{
$Rows = sqlsrv_has_rows($Result);
if ($Rows)
{
$Row = sqlsrv_fetch_array($Result, SQLSRV_FETCH_NUMERIC);
$Result = $Row[0];
return $Result;
}
}
return $_DefaultValue;
}
链接地址: http://www.djcxy.com/p/26574.html
上一篇: 为什么PHP的mysql