php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15880 select (name) from ..... doesnt work!
Submitted: 2002-03-05 10:29 UTC Modified: 2002-04-16 09:17 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: john at john dot pp dot se Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.1.1 OS: linux
Private report: No CVE-ID: None
 [2002-03-05 10:29 UTC] john at john dot pp dot 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'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-05 10:37 UTC] john at john dot pp dot se
SQL query:
  select name from main;
doesnt work either.
 [2002-03-06 09:17 UTC] adasi at grubno dot da dot 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-23 02:43 UTC] paul79 at optonline dot net
$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
 [2002-03-23 12:51 UTC] john at john dot pp dot se
$rh = mysql_query("select max(id) from ident;") or die("SQL error");

This line works wonderfully on my described version of php and removing the ending ';' doesn't change a thing.

This isn't the bug either! Read it through again and you'll see!
 [2002-04-16 09:17 UTC] kalowsky@php.net
please read the documentation on OBDC and learn how to use it before submitting a bug.  Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC