php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27497 dbx does not know about COUNT
Submitted: 2004-03-04 13:32 UTC Modified: 2004-03-04 16:40 UTC
From: leonard at den dot ottolander dot nl Assigned:
Status: Not a bug Package: DBX related
PHP Version: 4.3.4 OS: Linux (RH 9 and FC 1)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: leonard at den dot ottolander dot nl
New email:
PHP Version: OS:

 

 [2004-03-04 13:32 UTC] leonard at den dot ottolander dot nl
Description:
------------
dbx gives a syntax error when using COUNT:

SELECT COUNT (`ID`) FROM `category` WHERE `packageID` = 593
You have an error in your SQL syntax near '(`ID`) FROM `category` WHERE `packageID` = 593' at line 1

First seen on Red Hat Linux 9, php-4.2.2, but reproduced on Fedora Core 1, php-4.3.4.


Reproduce code:
---------------
$q = ...COUNT...;
echo $q;
$res = dbx_query($link, $q);
if ($res == 0) {
  echo dbx_error($link);
}



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-04 13:45 UTC] derick@php.net
This doesn't have anything to do with DBX, but with the database backend that you use for it. That one simply doesn't support "COUNT". Not a bug in PHP -> bogus.
 [2004-03-04 15:08 UTC] leonard at den dot ottolander dot nl
? I use mysql as a backend. Running the same query in phpMyAdmin works just fine.
 [2004-03-04 16:33 UTC] leonard at den dot ottolander dot nl
Ok. I can reproduce this when using mysql_query as well. Can you recomponent this or should I refile under mysql?
And why is this no issue when running the same query using phpMyAdmin?
 [2004-03-04 16:35 UTC] derick@php.net
afaik you can't have a space between COUNT and (, but nonetheless this is NOT a PHP bug as we just return the error from MySQL. PHP doesn't touch the queries at all.
 [2004-03-04 16:40 UTC] leonard at den dot ottolander dot nl
Duh. Luckily you can't see how red my face is. Obviously phpMyAdmin strips out the redundant space. Sorry and thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 19:01:26 2024 UTC