I would actually recommend running the built in MSSQL functions in PHP, I
have a stored procedure on a MSSQL server that updates and returns
information, and PHP handles it fine.  You will have to enable the
PHP_MSSQL.dll library (if on Windows) in the php.ini file.  Here's an
example of the stored procedure and the method to call it:


---- Stored Procedure ----

CREATE PROCEDURE InsertRequest (@RequestingUser Varchar(25),
        @Department Varchar(25),
        @RelatedTo Varchar(25),
        @RequestDate Datetime,
        @RequestCategory Varchar(25),
        @RequestPriority Int,
        @PriorityJustification Text,
        @StartDate Datetime,
        @CompletionDate Datetime,
        @CompletionJustification Text,
        @Description Text,
        @Attachments Text,
        @MeetBefore Int,
        @ReportsTo Varchar(25),
        @Client Varchar(255),
        @RequestID Int OUTPUT)  AS

INSERT INTO Requests (RequestingUser, Department, RelatedTo, RequestDate, 
        RequestCategory, RequestPriority,
        PriorityJustification, StartDate, CompletionDate,
CompletionJustification,
        Description, Attachments, MeetBefore, ReportsTo, Client)
VALUES (@RequestingUser, @Department, @RelatedTo, @RequestDate,
        @RequestCategory, @RequestPriority, 
        @PriorityJustification, @StartDate, @CompletionDate,
        @CompletionJustification, @Description, @Attachments, @MeetBefore, 
        @ReportsTo, @Client)

SELECT @RequestID = @@Identity




---- PHP ----


<?

$return=MSSQL_QUERY("EXEC InsertRequest
'$authuser','$department','$relatedto','$requestdate','$category','$requestp
riority','$priorityjustification','$startdate','$completedate','$timelinejus
tification','$description','$attachments','$meetbefore','$taskreportsto','$c
lient',''");
        $id=@MSSQL_QUERY("select @@IDENTITY as 'taskid'");
        $result=@MSSQL_FETCH_ARRAY($id)
?>



-----Original Message-----
From: Shawn Greene [mailto:[EMAIL PROTECTED]] 
Sent: Friday, October 26, 2001 2:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP and Stored Procedures

Hi, I'm new to this newsgroup, and I can't seem to find this anywhere else,
so I thought I would ask.

I have a problem getting output from stored procedures through PHP.  I am
connecting to an MS-SQL server through odbc (easysoft OOB), however this is
a flexible environment.  What I really need to know is.....

Is it possible to recieve output from a stored procedure in PHP v 4.0.6 in
any environment, and if so, what kind of configuration is required.

A big question I know.. but any help what-so-ever is appreciated.


Shawn.




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to