Re: Re: Calling MSSQL Stored Procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alf

Based on a previous posting, the code for the stored procedure
spGetActivePromotions does not return a value. Therefore, $ret is going to
be undefined. The procedure returns a result set that you must iterate
via $rs:

    while (!$rs->EOF) {
        print_r($rs->fields);
        $rs->MoveNext();
    }

-- bob

> Robert, first let me thank you for your patience. I have copied the
> above into my program making minor changes as follows :-
> $PMdriver = "odbtp";
>
>     $PMdb = NewADOConnection('odbtp');
>     $PMdb->debug = true;
>
>     // Connect to database via ODBTP server
>     $odbtp_server = '127.0.0.1';
>     $odbc_conn = 'DRIVER={SQL Server};SERVER=localhost;'
>                . 'UID=sa;PWD=;DATABASE=pm; ';
>     if( !$PMdb->PConnect( $odbtp_server, $odbc_conn ) ) {
>         print $PMdb->ErrorMsg();
>         die;
>     }
>     $SQL = $PMdb->PrepareSP('spGetActivePromotions');
>     if (!$SQL) {
>         print $PMdb->ErrorMsg();
>         die;
>         }
>
>     $ActualDate = time();
>
>     $PMdb->Parameter($SQL, $ActualDate, "Today");
>     $PMdb->Parameter($SQL, $ret, 'RETURN_VALUE', $isOutput=true);
>     $rs = $PMdb->Execute($SQL);
>     if (!$rs) {
>         print $PMdb->ErrorMsg();
>         die;
>         }
>
>     echo $ret;
>
> and I get nothing back, no error messages either on the screen or in
> Apache error.log but I do see a connection in the Apache logs.
> Please tell me what I have now got wrong.
>
> --
>
> Regards,
> Alf Stockton		www.stockton.co.za
>
> Perilous to all of us are the devices of an art deeper than we ourselves
> possess.
> 		-- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"]
>
> My email disclaimer is available at www.stockton.co.za/disclaimer.html
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux