我面临下一个问题:
我做了一个存储过程如下:
CREATE PROCEDURE verify_user_connection
@username nvarchar(50),
@pass nvarchar(50)
AS
BEGIN
SELECT users.username, users.pass
FROM dbo.users
WHERE users.username = '@username'
AND users.pass = '@pass'
RETURN '@username'
END
从 PHP 代码中,我这样称呼他:
<?php
/* Handle form buttons. */
if (isset($_POST['login'])) {
if (!empty($_POST['username']) || !empty($_POST['pass'])) {
$username = $_POST['username'];
$password = $_POST['pass'];
$sql = "{ CALL dbo.verify_user_connection (@username = ?, @pass = ?) }";
$param = array($username, $password);
$result = sqlsrv_query($conn, $sql, $param);
$row = sqlsrv_fetch_object($result);
echo $row;
if (!$row) {
die(print_r(sqlsrv_errors()));
}
else {
echo "record found";
}
}
else {
echo "something went wrong";
}
}
?>
好吧,我在微软的 SQLSRV 驱动程序中有点新,我知道我的语法在这里不准确,有人能指出我的问题并向我解释我做错了什么吗?
提前致谢