Skip to Content.
Sympa Menu

freetds - [freetds] Problem with 0.61.2, PHP, MSSQL Server and Stored Procedure

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Darryl Friesen, ITS" <Darryl.Friesen AT usask.ca>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Problem with 0.61.2, PHP, MSSQL Server and Stored Procedure
  • Date: Mon, 08 Sep 2003 14:11:59 -0600

Details first: FreeTDS 0.61.2 on a Solaris 8 box; Apache 2.0.46; PHP 4.3.2.
Database servers are MS SQL Server 7 and 2000 (same problem with both)

I have a PHP script that worked with FreeTDS 0.53 but fails now with 0.61.2.
I'm trying to execute a system stored procedure (sp_columns) to get
information about a table. mssql_query() seems to be returning a boolean
(TRUE) rather than a result resource, and the call to mssql_fetch_array()
fails (of course).

The result data does appear in the TDS log, so I'm almost inclined to rule
this a PHP bug, but I thought I'd run it past you good folks first. I'll
attach my TDS dump, and I've included my test script below.

If I can, or need to, provide anymore information, please let me know. I'm
more than willing.

Thanx,

- Darryl

----------------------------------------------------------------------
Darryl Friesen, B.Sc., Programmer/Analyst Darryl.Friesen AT usask.ca
Education & Research Technology Services, http://gollum.usask.ca/
Information Technology Services Division,
University of Saskatchewan
----------------------------------------------------------------------
"Go not to the Elves for counsel, for they will say both no and yes"



<?php

putenv('TDSDUMP=/tmp/freetds.dump');
putenv('TDSDUMPCONFIG=/tmp/freetds.config');

$dbh = mssql_connect('BEDROCK', 'username', 'password');

$sql = "EXECUTE sp_columns @table_name='PTypes'";
print "DEBUG: query is " . $sql . "<br>\n";

$result = mssql_query($sql);
print "DEBUG: result is $result<br>\n";

while ($field = mssql_fetch_array($result))
{
$field_data[] = $field;
}

mssql_close($dbh);
?>


Output of the above is:

DEBUG: query is EXECUTE sp_columns @table_name='PTypes'
DEBUG: result is 1

Attachment: freetds.dump
Description: Binary data



  • [freetds] Problem with 0.61.2, PHP, MSSQL Server and Stored Procedure, Darryl Friesen, ITS, 09/08/2003

Archive powered by MHonArc 2.6.24.

Top of Page