Reputation: 2610
i'm facing this next problem:
i made a stored procedure as follow:
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
and from the PHP code i call him like this:
<?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";
}
}
?>
well i'm kinda new in SQLSRV driver of microsoft and i know my syntax is not accurate here could someone inlight my problem and explain to me what am i doing wrong??
thanks in advance
Upvotes: 0
Views: 4046
Reputation: 8626
This is'nt going to be much help, but the most reliable mthod for using SQL Server and SP's that I've found is by using PHP ADODB ( http://adodb.sourceforge.net/#download ) to connect and call procs.
I have always found the in-built sql server functions patchy at best when working with SQL server.
If you are still struggling I am happy to give you more info via email.
Upvotes: 1