#11490 [Com]: mssql_connect() broken, mssql_pconnect() fixes it
| From: | 69-reviews3 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:06:52 +0000 |
| Subject: | #11490 [Com]: mssql_connect() broken, mssql_pconnect() fixes it | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62968@lists.php.net to get a copy of this message | ||
ID: 11490
Comment by: 69-reviews3 at hotmail dot com
Reported By: mlathoud at b2b2c dot ca
Status: Closed
Bug Type: Sybase-ct (ctlib) related
Operating System: Debian GNU/Linux i686
PHP Version: 4.0.5
New Comment:
<a href=http://69-legal-hairy-down.da.ru>reviews 69</a>
Previous Comments:
------------------------------------------------------------------------
[2001-12-27 15:09:16] mlathoud at b2b2c dot ca
Fixed in latest php code.
------------------------------------------------------------------------
[2001-12-18 13:40:39] lobbin@php.net
Can this be reproduced with a later version of freetds and/or?
R.
------------------------------------------------------------------------
[2001-06-14 14:03:03] 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.
<?
mssql_pconnect("server","user","pass");
viewdb("SELECT
RegNumber,ISCorporate,Customers.FirstName+Customers.MiddleName+Customers.LastName,Customers.Address,Customers.City,
Customers.State,Customers.ZIP,Customers.HomePhone,Customers.Fax,NickName
from Customers INNER JOIN SalesPersons on
Customers.SalesPersonID=Salespersons.SalesPersonID");
function viewdb($query) {
$r=mssql_query($query);
if (!$r) {
print "No results";
exit;
};
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;
$fields[]=$val;
print "<th>$val";
};
print "<tr>\n";
};
foreach ($fields as $field) {
print "<td>".$res->$field."\n";
};
};
print "</table>";
};
------------------------------------------------------------------------
[2001-06-14 13:03:17] sniper@php.net
Add shortest possible example script which can be used
to reproduce this into this report.
------------------------------------------------------------------------
[2001-06-14 11:04:06] 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 extension=sybase_ct.so.
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).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=11490&edit=1