Re: Re: Calling MSSQL Stored Procedure

From: Date: Mon, 19 Sep 2005 16:14:05 +0000
Subject: Re: Re: Calling MSSQL Stored Procedure
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-26362@lists.php.net to get a copy of this message
Robert Twitty wrote:
Since you are using php_mssql.dll, you should use php_odbtp.dll instead of php_odbtp_mssql.dll to prevent namespace conflicts. The ADODb driver name is 'odbtp', and the database connection should be performed similar to the following: $db = NewADOConnection('odbtp'); // Connect to database via ODBTP server $odbtp_server = '127.0.0.1'; $odbc_conn = 'DRIVER={SQL Server};SERVER=mysqlserver;'
              . 'UID=myuid;PWD=mypwd;DATABASE=mydb; ';
if( !$db->PConnect( $odbtp_server, $odbc_conn ) ) {
       print $DB->ErrorMsg();
       die;
} 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

« previous php.windows (#26362) next »