Ver Mensaje Individual
  #7 (permalink)  
Antiguo 19/05/2005, 12:39
Avatar de Gabriel0702
Gabriel0702
 
Fecha de Ingreso: febrero-2005
Mensajes: 155
Antigüedad: 19 años, 1 mes
Puntos: 0
La función no es de PHP, es una función que implementa Dreamweaver en uno de sus comportamientos, es sólo para darle formato a los datos que serán tomados en cuenta para una consulta o un comando SQL, te la paso para que la cheques:

Código:
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}