mysql query in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fra

    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
  • Lorenzo Bettini

    #2
    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 |
    +-----------------------------------------------------+

    Comment

    • Pedro Graca

      #3
      Re: mysql query in PHP

      fra wrote:
      any idea?
      Please don't multi-post.



      Answered in comp.databases. mysql.

      --
      File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

      Comment

      • fra

        #4
        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

        Comment

        Working...