Bluehost.com Web Hosting $6.95

mysql query in PHP

This is a discussion on mysql query in PHP within the PHP Language forums, part of the PHP Programming Forums category; hi everybody, i got a strange problem with a simple mysql query in php. simply, it doesn't work on ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-06-2006
fra
 
Posts: n/a
Default mysql query in PHP

hi everybody,
i got a strange problem with a simple mysql query in php.
simply, it doesn't work on my page (while it does through phpmyadmin):
there's the query:
$sql="
SELECT operatore, azione, COUNT( azione ), SUM ( numore )
FROM `utentiAzioni`
WHERE completata = '1'
GROUP BY operatore, azione ORDER BY operatore
"
the error message is:
"You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '( numore ) FROM `utentiAzioni` WHERE completata = '1' GROUP BY
a..."

any idea?
thanks in advance
francesco


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply With Quote
  #2 (permalink)  
Old 10-06-2006
Lorenzo Bettini
 
Posts: n/a
Default Re: mysql query in PHP

fra wrote:
> hi everybody,
> i got a strange problem with a simple mysql query in php.
> simply, it doesn't work on my page (while it does through phpmyadmin):
> there's the query:
> $sql="
> SELECT operatore, azione, COUNT( azione ), SUM ( numore )
> FROM `utentiAzioni`
> WHERE completata = '1'
> GROUP BY operatore, azione ORDER BY operatore
> "
> the error message is:
> "You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near '( numore ) FROM `utentiAzioni` WHERE completata = '1' GROUP BY
> a..."
>
> any idea?
> thanks in advance
> francesco
>
>


In think that you must not leave spaces between a function name (SUM)
and its arguments: SUM( numore )

--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| Home Page : http://www.lorenzobettini.it |
| http://tronprog.blogspot.com BLOG |
| http://www.purplesucker.com Deep Purple Cover Band |
| http://www.gnu.org/software/src-highlite |
| http://www.gnu.org/software/gengetopt |
| http://www.lorenzobettini.it/software/gengen |
| http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+
Reply With Quote
  #3 (permalink)  
Old 10-06-2006
Pedro Graca
 
Posts: n/a
Default Re: mysql query in PHP

fra wrote:
> any idea?


Please don't multi-post.
http://www.cs.tut.fi/~jkorpela/usenet/xpost.html#why
http://oakroadsystems.com/genl/unice.htm#xpost

Answered in comp.databases.mysql.

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Reply With Quote
  #4 (permalink)  
Old 10-06-2006
fra
 
Posts: n/a
Default Re: mysql query in PHP

> In think that you must not leave spaces between a function name (SUM)
> and its arguments: SUM( numore )


right, thanks
francesco



--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:25 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0