PHP with MSSQL (error) help!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Atiq
Forum Commoner
Posts: 26
Joined: Thu Feb 19, 2004 5:23 am

PHP with MSSQL (error) help!

Post by Atiq »

I am using php with MSSQL.

I am trying to run a procedure from php script.

When i ran the same procedure from Query Analyzer it returned 14 rows.

But when i tried to run it from php script and tried to get the total number of rows back i got this error:

Fatal error: Call to a member function on a non-object in c:\program files\apache group\apache\htdocs\cms\overall_score_pdf.php on line 8

Please note that i am using adodb . This is my code:

$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$record1 = $DB_CONNECTION->Execute('SP_Overall_Result');
$TOTAL_RECORDS = $record1->RecordCount();
echo "total=".$TOTAL_RECORDS; (this is line 8 in my script)
exit;

This code is working with all other procedures but not with this . In SQL Server this procdure took 58 seconds to give results.
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

Sounds like the COM object creation didn't work...

You have the code bleow in your script?

// COM Object declaration
$cn = new com("ADODB.Connection");
$rs = new com("ADODB.Recordset");

// Open connection from ODBC-Data Source
$cn->open("dsn=perkuliahan");
Post Reply