Jump to content


PHP MSSQL Stored Procedure

  • Please log in to reply
No replies to this topic

#1 stockton

  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts
  • LocationMidrand South Africa

Posted 19 January 2006 - 11:34 AM

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);
the stored procedure that I am attempting to use looks like :-
CREATE PROCEDURE spGetActivePromotions
@Today datetime
SELECT PromotionID, PromotionName, StartDate, EndDate, LastDrawDate,
MaxDraws, NumRegTickets, VouchersPermitted, NumTicketsPerVoucher, ManualTicketIssue
FROM Promotion
WHERE @Today>=StartDate AND @Today<=EndDate
Alf Stockton   Programmer for rent.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users