0

**Parse error: syntax error, unexpected T_VARIABLE in this line "$validate_user_information = sqlsrv_query "select * from userinfo where badgenumber = '"$user_ssn"'";"

//Login Page Starts here
    elseif($_POST["page"] == "users_login") 
    {
        $user_ssn = trim(strip_tags($_POST['badgenumber']));

        $validate_user_information = sqlsrv_query "select * from `userinfo` where `badgenumber` = '"$user_ssn"'";

        if(sqlsrv_num_rows($validate_user_information) == 1)
        {
            $get_user_information = sqlsrv_fetch_array($validate_user_information);
            $_SESSION["VALID_USER_ID"] = $user_ssn;
            echo 'login_process_completed_successfully=yes';
        }
        else
        {
            echo '<br><div class="info">Sorry, you have provided incorrect information. Please enter correct user information to proceed or contact your College Web Administrator. Thank You</div><br>';
        }
    }
    //Login Page Ends here
3
Contributors
3
Replies
13
Views
3 Years
Discussion Span
Last Post by andrevanzuydam
0

That syntax doesn't look right. At the very least there should be () around the string and, if memory serves, sqlsrv_query takes more parameters than that... but I could be wrong (too lazy to look up the docs)

0

can you give a a sample code for log in using php and mssql database??

0

Hi Jay

I've implemented both native and open source drivers in mssql in Cross Database Engine, you should give it a spin, save you hours of time figuring out what to do. All the connection strings are the same.

http://sourceforge.net/projects/cdeengine/

I would have a look at your SQL, no need to use the escape tags for your table names, you are missing concatenation also.

$sql = "select * from userinfo where badgenumber = '{$user_ssn}'";
$stmt = sqlsrv_query( $conn, $sql);
$arr = sqlsrv_fetch_array ( $stmt);

//inside the $arr are your values you need 

Cross database engine is simpler to use and you don't need to remember whether the connection param comes first or last.

$sql = "select * from userinfo where badgenumber = '{$user_ssn}'";
$obj = $CDE->get_value (0,  $sql); //object
$arr = $CDE->get_value (0,  $sql, 1); //array

Hope that helps your problem

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.