Loading ...
Sorry, an error occurred while loading the content.

Re: [PHP-WIN] Need help with mysql error

Expand Messages
  • Gu®u
    Hi All, Yes add is a reserved word & that was my mistake. I was looking it from PHP side all the time. I didn t thought about MYSQL stuff. I have changed it
    Message 1 of 3 , Jun 7, 2013
    • 0 Attachment
      Hi All,

      Yes 'add' is a reserved word & that was my mistake. I was looking it from PHP side all the time. I didn't thought about MYSQL stuff. I have changed it to 'os_add' and now its working. Thanks guys. You guys rock :)




      On Fri, Jun 7, 2013 at 8:47 PM, Arno Kuhl <arno@...> wrote:
      -----Original Message-----
      From: GuRu [mailto:nagendra802000@...]
      Sent: 07 June 2013 12:22 PM
      To: php-windows@...; php mysql; phpexperts@yahoogroups.com
      Subject: [PHP-WIN] Need help with mysql error

      Hi All,

      I am working a a project in which there is a table with some variables. I
      have a form with which I pull the filled data by user and want to put into
      mysql dtabase. Below is my query.

      $sql="INSERT INTO recipt (date, pt_name, age, od_sph, od_cyl, od_axis,
      os_sph, os_cyl, os_axis, add, d_sph, od_d, od_n, od1, os1) VALUES
      ('$_POST[date]','$_POST[pt_name]','$_POST[age]','$_POST[od_sph]','$_POST[od_
      cyl]','$_POST[od_axis]','$_POST[os_sph]','$_POST[os_cyl]','$_POST[os_axis]',
      '$_POST[add]','$_POST[d_sph]','$_POST[od_d]','$_POST[od_n]','$_POST[od1]','$
      _POST[os1]')";

      However I am getting an error saying:

      Error: 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
      'add, d_sph, od_d, od_n, od1, os1) VALUES ('12-12-2013','guru
      prasad','23','12'' at line 1

      I have tried gooling it but no luck. Please help me with this error.

      Thank you in advance.

      --
      *Best,
      *
      *GuRu
      CEO & Founder at,
      www.myshopads.com
      *
      ==============================

      Could "add" be a reserved word? Try a different column name and see if you
      get the same error.

      Cheers
      Arno





      --
      Best,
      Gu®u
      CEO & Founder at,
      www.myshopads.com
    • shiplu
      ... PHP side all the time. I didn t thought about MYSQL stuff. I have changed it to os_add and now its working. Thanks guys. You guys rock :) ... You can use
      Message 2 of 3 , Jun 20, 2013
      • 0 Attachment


        On Jun 7, 2013 9:28 PM, "Gu®u" <nagendra802000@...> wrote:
        >
        >
        >
        > Hi All,
        >
        > Yes 'add' is a reserved word & that was my mistake. I was looking it from PHP side all the time. I didn't thought about MYSQL stuff. I have changed it to 'os_add' and now its working. Thanks guys. You guys rock :)
        >

        You can use reserved keywords as column names too.  Just use ` to enclose the name. Like `add`

      • Shiplu
        You can use reserved keywords as column names too. Just use ` to enclose the name. Like `add`
        Message 3 of 3 , Jun 20, 2013
        • 0 Attachment

          You can use reserved keywords as column names too.  Just use ` to enclose the name. Like `add`

        Your message has been successfully submitted and would be delivered to recipients shortly.