I get a error --> sqlsrv_num_rows() expects parameter 1 to be resource
Can anyone figure out whats wrong with the coding, ive been trying for 3 hours now
Thanks in advance :)
<?php
include("config.php");
username and password sent from form
$myusername=htmlspecialchars($_POST[username]);
$mypassword=htmlspecialchars($_POST[password]);
$sql="SELECT * FROM Login WHERE Username=$myusername and
Password=$mypassword";
$result=sqlsrv_query($conn,$sql);
$count=sqlsrv_num_rows($result);
if($count==1){
header("location: something");
}
else {
echo "Wrong Username or Password";
}
?>
CONFIG.PHP
<?php
$serverName = '';
$uid = '';
$pwd = '';
$databaseName = '';
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
}
?>