Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/07/2012, 11:20
Avatar de j84625
j84625
 
Fecha de Ingreso: junio-2008
Ubicación: Valencia
Mensajes: 170
Antigüedad: 18 años, 4 meses
Puntos: 2
registro de usuario sqlsrv_connect

hace mucho que no realizo nada en php desde php 5.2 y tengo problemas con este codigo aun no esta terminado pero no funciona

Código PHP:
<?php
$serverName 
= "host\SQLEXPRESS"; //serverName\instanceName
$connectionInfo = array( "Database"=>"db", "UID"=>"sa", "PWD"=>"pass");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( 
$conn ) 
{
    if ((
eregi("[^a-zA-Z0-9_-]", stripslashes($_POST['RUser']))) || (eregi("[^a-zA-Z0-9_-]", stripslashes($_POST['RPass']))) || (eregi("[^a-zA-Z0-9_-]", stripslashes($_POST['RCorreo']))))
    {
    echo(
"<style type='text/css'>
                <!--
                body {
                background-color: #B0C0EC;
                }
                -->
                </style>Error solo letras y numeros"
);
    exit();
    }
    else
        {
            
$RUser = stripslashes($_POST['RUser']);
            
$RPass = stripslashes($_POST['RPass']);
            
$RCorreo = stripslashes($_POST['RCorreo']);
    
            
$sql = "select memb___id from MEMB_INFO where memb___id = '$RUser'";
            
$params = array(1, "some data");
    
            
$stmt = sqlsrv_query( $conn, $sql);
            if( 
$stmt === false ) {
                 die( 
print_r( sqlsrv_errors(), true));
            }
            
            while( 
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
                 if (
$RUser == $row[0])
                    {
                        echo(
"<style type='text/css'>
                            <!--
                            body {
                            background-color: #B0C0EC;
                            }
                            -->
                            </style>El Usuario ya existe"
);
                    }
                    else
                        {
                            
                            
$sql = "insert into dbo.MEMB_INFO (memb___id,memb__pwd,memb_name,sno__numb,bloc_code,ctl1_code) Values ('$RUser','$RPass','RCorreo',1,0,1)";
                            
$params = array(2, "some data");
                            
                            
$stmt = sqlsrv_query( $conn, $sql);
                            if( 
$stmt === false ) {
                                 die( 
print_r( sqlsrv_errors(), true));
                            }
                                
                        }
}

sqlsrv_free_stmt( $stmt);
            
        }
}

else{
     echo 
"Lamentablemente se produjo un error por favor notifiquelo al administrador.<br />";
     die( 
print_r( sqlsrv_errors(), true));
}
?>
si alguno esta dispuesto ayudarme mandar mp