Returning values from stored procedure

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sbest@circlesofcare.org

    Returning values from stored procedure


    Hi all,

    I am trying to execute a MS-SQL 2000 stored proedure from PHP 4.2.2 and
    return the single row of 3 output values. I've whittled down the error
    messages so that I'm now mainly getting an error message that the
    MS-SQL Query ($sql) failed.
    Here's the stored procedure statements that define the input and output
    variables:

    CREATE PROCEDURE dbo.sl_mostrece nt_State
    @MIS int,
    @Type int,
    @misout int OUTPUT,
    @mostrecent varchar (40) OUTPUT,
    @nextdue varchar (40) OUTPUT

    And, here's my PHP (the 2 input variables, $MIS and $type, are passed
    from the previous php page):


    <?php

    include("config ure_report.php" );

    if ($MIS) {
    $conn = mssql_connect($ SQLServer,$SQLU sername,$SQLPas sword) or
    printError("Una ble to connect to Database Server.");

    mssql_select_db ($SQLDB);

    $ANW=' SET ANSI_NULLS ON
    SET ANSI_WARNINGS ON';

    $sql = mssql_init("sl_ mostrecent_Stat e");

    $temp = mssql_query($AN W);

    mssql_bind($sql , '@MIS', $MIS, SQLINT4, FALSE, FALSE);

    mssql_bind($sql , '@Type', $type, SQLINT4, FALSE, FALSE);

    mssql_bind($sql , '@misout', $SMIS, SQLINT4, TRUE, FALSE);

    mssql_bind($sql , '@mostrecent', $fdate, SQLVARCHAR, TRUE, FALSE);

    mssql_bind($sql , '@nextdue', $sdate, SQLVARCHAR, TRUE, FALSE);

    $trigger = mssql_query($sq l);

    mssql_close($co nn);

    }

    ?>

    Any guidance/ideas would be greatly appreciated!
    -Sarah Best

Working...