php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13286 Freetds + iODBC problems retrivind numeric fields
Submitted: 2001-09-13 12:19 UTC Modified: 2002-06-24 22:45 UTC
From: fernando at robynet dot com dot br Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.4pl1 OS: Linux Mandrake
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fernando at robynet dot com dot br
New email:
PHP Version: OS:

 

 [2001-09-13 12:19 UTC] fernando at robynet dot com dot br
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>";
 }

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-24 22:45 UTC] kalowsky@php.net
The iODBC system works fine with your sample when connecting to the Virtuoso and PostgreSQL-ODBC databases.  So I'm guessing this has to do with the Freetds interaction.

Two suggestions:

1) try a newer version of PHP and see if it continues.  
2) if that doesn't fix, you might want to also open a bug with Openlink Software in regards to this... as it sounds like a driver level issue if it works with some and not others.  
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 17:01:27 2024 UTC