0

hi i created login page using php and mssql but i got an error
"Fatal error: Call to undefined function mssql_query() "

heres my log in code

<form name="log" action="log_action.php" method="post">
Username: <input class="form" type="text" name="name"><br />
Password: <input class="form" type="password" name="ssn"><br />
<input name="submit" type="submit" value="Submit">
</form>

log_in form

<?php
session_start();
include "ms_connection.php";
$name = $_REQUEST['name'];
$ssn  = $_REQUEST['ssn'];
$query = "SELECT * FROM userinfo WHERE name = '$name' AND ssn='$ssn'";
$result = mssql_query($query,$conn);
$num = mssql_num_rows($result);


$_SESSION['valid_user'] = true;
$_SESSION['name'] = $name;
header('Location: index.php'); 
die(); 
}else{
header('Location: login1.php');
die();
}

ms_connection

<?php
$serverName = "server"; 
$uid = "uname";   
$pwd = "upassword";  
$databaseName = "dtr"; 

$connectionInfo = array( "UID"=>$uid,                            
                         "PWD"=>$pwd,                            
                         "Database"=>$databaseName); 

/* Connect using SQL Server Authentication. */  
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>
5
Contributors
6
Replies
31
Views
3 Years
Discussion Span
Last Post by veedeoo
0

my version of php is php5.3.13
and i already configured "extension=php_pdo_sqlsrv_53_ts.dll and extension=php_sqlsrv_53_ts.dll" php extensions in php.ini

Edited by Jay_7

0

As I understand it, you need to use the ODBC driver to connect PHP to mssql. I may be a bit behind on that info, but I would be curious to see if you are connecting at all.

0

can anybody give a a sample code on how to use ODBC driver to connect php to mssql?

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.