|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-07 17:51 UTC] sniper@php.net
[2005-04-13 17:33 UTC] jake at edge2 dot net
[2005-06-13 11:11 UTC] sniper@php.net
[2005-06-21 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
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)