Jump to content

Archived

This topic is now archived and is closed to further replies.

stockton

PHP MSSQL Stored Procedure

Recommended Posts

Please tell me what is wrong with the following piece of code:-
$Datum = date("'Y-m-d H:i:s'");
$link = mssql_connect("localhost", "sa", "")
or trigger_error('Could not connect to database', E_USER_ERROR);
mssql_select_db("pm", $link) or trigger_error('Could not select database', E_USER_ERROR);
$proc = mssql_init("spGetActivePromotions", $link);
mssql_bind($proc, "@Today", $Datum, SQLTEXT, FALSE,FALSE,strlen($Datum));
$Result = mssql_execute($proc);
if (!$Result) {
$Message = sprintf("mssql_execute failed for %s [%d].", $Datum, $Result);
trigger_error($Message, E_USER_ERROR);
die();
}
the stored procedure that I am attempting to use looks like :-
CREATE PROCEDURE spGetActivePromotions
@Today datetime
AS
SELECT PromotionID, PromotionName, StartDate, EndDate, LastDrawDate,
MaxDraws, NumRegTickets, VouchersPermitted, NumTicketsPerVoucher, ManualTicketIssue
FROM Promotion
WHERE @Today>=StartDate AND @Today<=EndDate
GO

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.