ID: 32593 User updated by: jake at edge2 dot net Reported By: jake at edge2 dot net Status: Open Bug Type: ODBC related Operating System: linux (fc3 and rh9) PHP Version: 4.3.10 New Comment:
got a newer version of the tgz file this morning, built it successfully (using ./configure --with-unixODBC=shared,/usr) and ran it like so: [EMAIL PROTECTED] php4-STABLE-200504131242]$ php -dextension_dir=`pwd`/ext ~/x.php and got exactly the same results as before (correct from pgsql, junk (n_u nT0) from mysql) I have also run into another problem, which may be related in that php-odbc does not seem to do quoting correctly for placeholders for either pgsql or mysql ... not sure if i should file a different bug or add it to this one ... it also occurs on this version of php Previous Comments: ------------------------------------------------------------------------ [2005-04-13 03:46:55] jake at edge2 dot net I tried downloading the snapshot tgz file, but i get an unrecoverable error from tar ... ------------------------------------------------------------------------ [2005-04-07 17:51:12] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2005-04-05 18:09:47] jake at edge2 dot net Description: ------------ If I use placeholders (?) in a SELECT statement using odbc_prepare() and odbc_execute(), I get gibberish from the MySQL driver and it works correctly using the PostgreSQL driver. If I change the query to "WHERE id=1", it works fine. UPDATES using placeholders work fine for MySQL. I am able to do the same queries in C using the same libraries for unixODBC and MyODBC (and postgres-odbc) and get correct results. This may not be a PHP and/or PHP-odbc problem, but so far, it looks that way. I get substantially the same results on an FC3 and a RH9 linux box with the following versions: FC3: php-4.3.10-3.2, php-odbc-4.3.10-3.2, unixODBC-2.2.9-1, MyODBC-2.50.39-19.1, mysql-3.23.58-14 RH9: php-4.2.2-17, php-odbc-4.2.2-17, unixODBC-2.2.3-6, MyODBC-2.50.39-11, mysql-3.23.54a-11 Reproduce code: --------------- #!/usr/bin/php <?php $conn = odbc_connect('tstdb', 'xxxxx', 'yyyyy'); if ($conn == 0) { echo("connect failed"); $sqlerr = odbc_errormsg($conn); echo($sqlerr); } $stmt = odbc_prepare($conn, 'SELECT firstname, lastname FROM tst where id=?'); $result = odbc_execute($stmt, array(1)); if (!$result) { echo("SELECT failed"); $sqlerr = odbc_errormsg($conn); echo($sqlerr); } while (odbc_fetch_into($stmt, $row)) { print $row[0] . " " . $row[1] . "\n"; } ?> Expected result: ---------------- I expect to get the firstname and lastname from the database. The table is an int id and varchar(20) for the names. Actual result: -------------- Some kind of junk: "std n_u" Postgres gives the correct result (firstname and lastname from the database) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32593&edit=1