stockton Posted January 19, 2006 Share Posted January 19, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/3228-php-mssql-stored-procedure/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.