Bug #13286: Freetds + iODBC problems retrivind numeric fields
| From: | fernando at robynet dot com dot br | Date: | Thu, 13 Sep 2001 16:19:33 +0000 |
| Subject: | Bug #13286: Freetds + iODBC problems retrivind numeric fields | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-65884@lists.php.net to get a copy of this message | ||
From: fernando@robynet.com.br
Operating system: Linux Mandrake
PHP version: 4.0.4pl1
PHP Bug Type: ODBC related
Bug description: Freetds + iODBC problems retrivind numeric fields
I Have problems retrivind and printing fields type numeric and date.
Using iODBC to access SQL Server 7.0
My Configure Line:
./configure --prefix=/usr/local/matriz/php4
--with-apxs=/usr/local/matriz/apache/bin/apxs
--with-iodbc=/usr/local/matriz/iodbc --enable-track-vars
Script PHP:
<?php
putenv("LD_LIBRARY_PATH=/usr/local/freetds/lib/libtdsodbc.so");
putenv("ODBCINSTINI=/etc/odbcinst.ini");
putenv("ODBCINI=/etc/odbc.ini");
if ($con = odbc_pconnect("SQLSERVER","username","passwd")) { print
"Success!
<br>"; } else { print "Error connection <br>"; } // This line prints
"Success";
$sql = "SELECT * FROM contacts";
/* Contacts have 2 fields: Name (char) and Number (numeric) */
$prep = odbc_prepare($con,$sql);
if (odbc_execute($prep))
{
while (odbc_fetch_row($prep))
{
print odbc_result($prep,1); // Print correct name
print " - ";
print odbc_result($prep,2); // Print nothing, not return any error,
simply
prints ''
print "<br>\n";
}
}
else
{
print "Error executing query! <br>";
}
?>
--
Edit bug report at: http://bugs.php.net/?id=13286&edit=1