Para que serve GetSQLValueString
? E se há uma diferença para o PHP7, que diferença essa função faz? O que acontece se eu não usar? Alguém pode me ajudar a entender isso melhor?
if (!function_exists("GetSQLValueString"))
{
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
Depois disso, há uma seção que usa essa função.
if($cod_u > 0){
$updateSQL = sprintf("UPDATE usuario SET cod_id=%s, nome=%s, sexo=%s WHERE cod_u=%s",
GetSQLValueString( utf8_decode($_POST['cod_id']), "int"),