php - SQL Syntax Error when executing mysqli_query -


I have a PHP registration script with MySQLi and OOP. But when executing a query I get a mysql syntax error .

  There is an error in your SQL syntax; Manual 'related to MySQL server version', which is related to using 'pass' -mail, ip_register, ip_lastlogin, lastlogin for correct syntax value) (' ',' RAVX, ******, *** * 'Line 1 on   

PHP Code:

  $ register_sql = "User (id, username, password, PIN, e-mail, IP_ registration, ('', $ Username, $ password, $ pin, $ email, $ IP, IP, $ live tag) ";   

Does the problem solve?

 > mail sql is telling you where the error starts from * delinquent character   

You need to wrap / incubate the e-mail column in backtacks because there is a hyphen in it.

The SQL stats that you want to math which translate From: e zero mail

plus, quotation marks in your values ​​

  $ Register_sql = "Include in user (id, username, password, pin,` e-mail`, ip_registry, ip_listin, l ($ "", '$', '$ ip', '$ ip', '$ Lastlogin ') values ​​(' ',' $ username ',' $ password ',' $ pin ',);   

They are strings and should be inside quotes.

  • Another option would be to use the underscore by changing the name of your column e_mail as you did for some other columns, in this way, you need to use backlit Will not be

    Use any of the following:

    • .


      or to die (mysqli_error ($ con)) to mysqli_query () error (signals ).

      $ con Being your DB connection, it can be different from yours / standing. / P>

      • Adjust accordingly.

        Identifier (table / column)

        • More on this subject:

          Try and complain about hyphen, or spaces or SQL Avoid using any other character, it involves using a place in the middle of the words.

          Ie:

            INSERT in your_table (column1, column2) & lt; = You will be required to use Backlit:  
            INSERT (`column1`) in your_table,` column- 2`) & lt; = True / valid   

          Although spaces are allowed ( still disappointed ), they should also be explained in backtacks.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -