Bug #15880 Updated: select (name) from ..... doesnt work!

From: Date: Sat, 23 Mar 2002 07:43:43 +0000
Subject: Bug #15880 Updated: select (name) from ..... doesnt work!
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-3184@lists.php.net to get a copy of this message
ID: 15880 Updated by: paul79@optonline.net Reported By: john@john.pp.se Status: Open Bug Type: ODBC related Operating System: linux PHP Version: 4.1.1 New Comment: $rh = mysql_query("select max(id) from ident;") or die("SQL error"); // Will never work and is not a bug $rh = mysql_query("select max(id) from ident") or die("SQL error"); // This will Please close this report Previous Comments: ------------------------------------------------------------------------ [2002-03-06 09:17:21] adasi@grubno.da.ru while using freetds+unixODBC+PHP i've found out that it's a problem of odbc_fetch_row. In freetds.log there was a request and reply (correct) but odbc_fetch_row gave empty value as output ------------------------------------------------------------------------ [2002-03-05 10:37:42] john@john.pp.se SQL query: select name from main; doesnt work either. ------------------------------------------------------------------------ [2002-03-05 10:29:54] john@john.pp.se Using the ODBC functions Im having problem with simple lines like: select max(id) from ident; select (name) from main; But lines like this works fine: select id, path, name from main order by path, name; When Im trying the same lines using the MySQL functions it works fine. Here is a script that shows my problem: $dbh = mysql_connect("localhost", $user, $password); mysql_select_db("vr", $dbh); $rh = mysql_query("select max(id) from ident;") or die("SQL error"); $t = mysql_fetch_row($rh); echo "Using MySQL I get id: ". $t[0]; mysql_close($dbh); $dbh = odbc_connect($dsn, $user, $password); $rh = odbc_exec($dbh, "select max(id) from ident;") or die("SQL error"); $t = odbc_fetch_row($rh); echo "Using ODBC I get id: ". $t[0]; odbc_close($dbh); What is does is it prints out the value it gets from each query. The output I get is: Using MySQL I get id: 68 Using ODBC I get id: I can get this to work with perl using DBI and DBI-ODBC so I strongly believes the problem lies in the ODBC implementation in php. My configure line is like this: './configure' '--with-mysql=/usr/local/mysql' '--with-apxs=/usr/local/apache/bin/apxs' '--with-db2' '--disable-debug' '--disable-static' '--enable-sockets' '--with-yp' '--with-zlib' '--with-iodbc=/usr/local/libiodbc-3.0.5' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15880&edit=1

« previous php.bugs (#3184) next »