|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11490 mssql_connect() broken, mssql_pconnect() fixes it
Submitted: 2001-06-14 11:04 UTC Modified: 2001-12-27 15:09 UTC
From: mlathoud at b2b2c dot ca Assigned:
Status: Closed Package: Sybase-ct (ctlib) related
PHP Version: 4.0.5 OS: Debian GNU/Linux i686
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mlathoud at b2b2c dot ca
New email:
PHP Version: OS:


 [2001-06-14 11:04 UTC] mlathoud at b2b2c dot ca
I am using Debian unstable, with the following relevant packages:
freetds0 0.51-4
php4 and php4-sybase 4.0.5-2
It's in fact using

When connecting to a MSSQL7 server, if I use mssql_connect(), only the first row of a query can be fetched, then I get "2 is not a valid Sybase result resource".
Simply switching to mssql_pconnect() fixes it (even when used with the standalone php4 binary).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-14 13:03 UTC]
Add shortest possible example script which can be used
to reproduce this into this report.

 [2001-06-14 14:03 UTC] mlathoud at b2b2c dot ca
Update: with a bigger query like the following (returning 2K+ rows with sqsl based on freetds), I always get
1 is not a valid Sybase-Link resource in <b>test.php</b> on line <b>9</b> when mssql_query()ing, using pconnect() or connect(). Hence, the bug is definately not in freetds, but in sybase_ct.
Side note, I am using php4.0.4pl1 with sybase/freetds (not _ct) on another debian (2.2, apache/php self-compiled)machine and it works just fine.

from Customers INNER JOIN SalesPersons on Customers.SalesPersonID=Salespersons.SalesPersonID");

function viewdb($query) {
        if (!$r) {
                print "No results";
        print "<p align=center><table border=1>";
        while ($res=mssql_fetch_object($r)) {
                print "<tr>\n";
                if (!isset($fields)) {
                        foreach (array_keys(get_object_vars($res)) as
$n=>$val) {
                                if (!($n%2)) continue;
                        print "<th>$val";
                        print "<tr>\n";
                foreach ($fields as $field) {
                        print "<td>".$res->$field."\n";
        print "</table>";

 [2001-12-18 13:40 UTC]
Can this be reproduced with a later version of freetds and/or?

 [2001-12-27 15:09 UTC] mlathoud at b2b2c dot ca
Fixed in latest php code.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 00:01:30 2024 UTC