Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. MySQL
  4. what's wrong with this SQL string?

what's wrong with this SQL string?

Scheduled Pinned Locked Moved MySQL
databasemysqlsysadminhelpquestion
3 Posts 3 Posters 12 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bfis108137
    wrote on last edited by
    #1

    This is the string that I have printed to the screen.

    INSERT INTO signatures (name, order, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888','','guy','62.219.49.132','','1','')

    The following is the code that executes the query

    if (!mysql_query($sqlString, $con))
    {
    die('Error: ' . mysql_error());
    $success = false;
    }

    It gives me the following error 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 'order, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888'' at line 1

    L H 2 Replies Last reply
    0
    • B bfis108137

      This is the string that I have printed to the screen.

      INSERT INTO signatures (name, order, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888','','guy','62.219.49.132','','1','')

      The following is the code that executes the query

      if (!mysql_query($sqlString, $con))
      {
      die('Error: ' . mysql_error());
      $success = false;
      }

      It gives me the following error 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 'order, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888'' at line 1

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      one of them must be a reserved keyword, for which an escape exists, IIRC it is square brackets. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      1 Reply Last reply
      0
      • B bfis108137

        This is the string that I have printed to the screen.

        INSERT INTO signatures (name, order, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888','','guy','62.219.49.132','','1','')

        The following is the code that executes the query

        if (!mysql_query($sqlString, $con))
        {
        die('Error: ' . mysql_error());
        $success = false;
        }

        It gives me the following error 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 'order, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888'' at line 1

        H Offline
        H Offline
        haha220688
        wrote on last edited by
        #3

        INSERT INTO signatures (name, `order`, email, salesperson, ip, browser, signed, referrer) VALUES('b','888888888','','guy','62.219.49.132','','1','') order====>`order`

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups