RE: Sanitizing potential MySQL strings with no database connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> If says:
> 
> Returns the escaped string, or FALSE on error.
> 
> So all you have to do, is have warnings turned off (as it generates an
> E_WARNING if you have no active connection) and then look at the return
> value of a call to the function:
> 
> if(mysql_real_escape_string($variable) === false)
> {
>     // create a default DB connection
> }

I would rather suggest:

$error_reporting = error_reporting(0);
if(mysql_real_escape_string($variable) === false)
{
    // create a default DB connection
}
error_reporting($error_reporting);
unset($error_reporting);

 		 	   		  
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux