ID:               32593
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jake at edge2 dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         ODBC related
 Operating System: linux (fc3 and rh9)
 PHP Version:      4.3.10
 New Comment:

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




Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to