Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/05/2013, 02:24
xexio
 
Fecha de Ingreso: noviembre-2011
Mensajes: 102
Antigüedad: 13 años, 4 meses
Puntos: 0
Duda con código.

Estoy usando dreamweaver para hacer un acceso a una web, un Login vamos.

Y introduce automaticamente el siguiente codigo.

Código PHP:
    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;
        }
    } 
Para usarlo posteriormente aqui

Código PHP:
$LoginRS__query=sprintf("SELECT idUsuario, strEmail, strPassword FROM tblusuario WHERE strEmail=%s AND strPassword=%s",
            
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
La pregunta es, como se podria dejar la sentencia de SQL para no tener que usar esa funcion?:S