MySQL 1064 Error: You have an error in your SQL syntax

So, you’re creating a custom SQL query to perform a task in the database. After putting the code together and running it in PHPmyAdmin it responds with a 1064 error. It may look similar to this:

1064 error message

The 1064 error displays any time you have an issue with your SQL syntax, and is often due to using reserved words, missing data in the database, or mistyped/obsolete commands. So follow along and learn more about what the 1064 error is, some likely causes, and general troubleshooting steps.

Note: Since syntax errors can be hard to locate in long queries, the following online tools can often save time by checking your code and locating issues:

Causes for the 1064 error

This may seem cryptic since it is a general error pointing to a syntax issue in the SQL Query statement. Since the 1064 error can have multiple causes, we will go over the most common things that will result in this error and show you how to fix them. Follow along so you can get your SQL queries updated and running successfully.

Using Reserved Words

Every version of MySQL has its own list of reserved words. These are words that are used for specific purposes or to perform specific functions within the MySQL engine. If you attempt to use one of these reserved words, you will receive the 1064 error. For example, below is a short SQL query that uses a reserved word as a table name.

CREATE TABLE alter (first_day DATE, last_day DATE);

How to fix it:

Just because the word alter is reserved does not mean it cannot be used, it just has special requirements to use it as the MySQL engine is trying to call the functionality for the alter command. To fix the issue, you will want to surround the word with backticks, this is usually the button just to the left of the “1” button on the keyboard. The code block below shows how the code will need to look in order to run properly.

CREATE TABLE `alter` (first_day DATE, last_day DATE);

Missing Data

Sometimes data can be missing from the database. This causes issues when the data is required for a query to complete. For example, if a database is built requiring an ID number for every student, it is reasonable to assume a query will be built to pull a student record by that ID number. Such a query would look like this:

SELECT * from students WHERE studentID = $id

If the $id is never properly filled in the code, the query would look like this to the server:

SELECT * from students WHERE studentID =

Since there is nothing there, the MySQL engine gets confused and complains via a 1064 error.

How to fix it:

Hopefully, your application will have some sort of interface that will allow you to bring up the particular record and add the missing data. This is tricky because if the missing data is the unique identifier, it will likely need that information to bring it up, thus resulting in the same error. You can also go into the database (typically within phpMyAdmin) where you can select the particular row from the appropriate table and manually add the data.

Mistyping of Commands

One of the most common causes for the 1064 error is when a SQL statement uses a mistyped command. This is very easy to do and is easily missed when troubleshooting at first. Our example shows an UPDATE command that is accidentally misspelled.

UDPATE table1 SET id = 0;

How to fix it:

Be sure to check your commands prior to running them and ensure they are all spelled correctly.

Below is the syntax for the correct query statement.

UPDATE table1 SET id = 0;

Obsolete Commands

Some commands that were deprecated (slated for removal but still allowed for a period of time) eventually go obsolete. This means that the command is no longer valid in the SQL statement. One of the more common commands is the ‘TYPE‘ command. This has been deprecated since MySQL 4.1 but was finally removed as of version 5.1, where it now gives a syntax error. The ‘TYPE‘ command has been replaced with the ‘ENGINE‘ command. Below is an example of the old version:

CREATE TABLE t (i INT) TYPE = INNODB;

This should be replaced with the new command as below:

CREATE TABLE t (i INT) ENGINE = INNODB;

Upgrade to VPS Hosting for Peak Performance

Upgrade to InMotion VPS Hosting today for top-notch performance, security, and flexibility, and save up to $2,412 – a faster, stronger hosting solution is just a click away!

check markSSD Storage check markHigh-Availability check markIronclad Security check markPremium Support

VPS Hosting

Error 1064 Summary

As you can see there is more than one cause for the 1064 error within MySQL code. Now, you know how to correct the issues with your SQL Syntax, so your query can run successfully. This list will be updated as more specific instances are reported.

231 thoughts on “MySQL 1064 Error: You have an error in your SQL syntax

  1. 02252024

    Hello,

    These conversations were informative.
    But I got these error messages after I migrated from Joomla 3.10 to Joomla 4 & 5 below as shown in this link: http://tinyurl.com/y9dx6xhh

    “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘ AND `null` = ‘NO” at line 1”

    And

    “There are tables not up to date!”

    Is there a fix for this?
    Thank you.

    Joseph Lariosa

  2. Hello everyone, I have a php website with laravel framework. The problem is every now and then randomly images gets deleted from my website basically from the storage folder. I have set the permissions for folders and sub-folders to 775 but still it happens. What could be the issue? can anyone help?

    1. I recommend reviewing the cPanel logs for any record of these files being accessed or edited. For example, your access logs or FTP logs may show the files being deleted or modified by a specific user. If you need assistance with this our Live Support team can provide a copy or help you search the logs.

  3. Hello i have an error here can u pleas help me?
    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘0) VALUES (Array)’ at line 1

    INSERT INTO `dtl_peminjaman` (0) VALUES (Array)

    1. It’s difficult to say without knowing the exact setup of your database, but you may not need to have single quotation marks around your table name and there would typically be a column name within the first parenthesis. For more information, I recommend reviewing the official MySQL documentation on the INSERT Statement, as it provides full details and examples.

  4. Hello i have an error here can u pleas help me?
    SELECT password FROM users WHERE password=” or ‘ 1=1’;
    “ERROR: (1064, “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 ‘1=1”’ at line 1″)”

    1. Hello Someone – Sorry for the issue with the SQL statement. You’re using the WHERE clause incorrectly. You need to be explicit when you’re defining it. Here’s an example (with OR): SELECT * FROM Customers
      WHERE City=’Berlin’ OR City=’München’; Start with that, and if you’re still having issues with your code, I suggest speaking with an experienced SQL developer for further assistance.

  5. $mysql=”INSERT INTO `ITEMS` VALUES (‘”.$itemid.”‘, ‘2210010001’, ‘001’, ‘”.$postdata[“itemname”].”‘, ‘”.$postdata[“itemdescription”].”‘, ‘”.$postdata[“aboutthis”].”‘, ‘”.$postdata[“aprice”].”‘, ‘”.$postdata[“dprice”].”‘, ‘”.$postdata[“itemlink”].”‘, ’76’, ’43’, ‘Y’)”;
    $result = mysqli_query($con, $mysql);
    if($result)
    $remarks=”New Added Successfully. ID=”.$itemid;
    else
    $remarks=”“.mysqli_error($con).”:“.$mysql;
    echo “remarks : “.$remarks;

    RESULT

    remarks :
    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 ‘INSERT INTO `ITEMS` VALUES (‘221004091058001’, ‘2210010001’, ‘001’, ”, ‘ at line 1:
    INSERT INTO `ITEMS` VALUES (‘221004091058001’, ‘2210010001’, ‘001’, ”, ”, ”, ‘4’, ‘5’, ‘6’, ’76’, ’43’, ‘Y’)

    1. Anand – all the code checkers confirm that there is a syntax issue in the INSERT INTO area of your code. The MySQL 8.0 reference provides these instructions for the INSERT command (https://dev.mysql.com/doc/refman/8.0/en/insert.html). You may need to speak with a database programmer if you require further assistance.

  6. Please I’m a newbie and i’m using the alain Beaulieu book ‘Learning SQL’ and on the first tutorial we need to add this function after creating the database ‘bank’. I have created it and typed the code but the shell returns the error after this code :

    mysql>grant all privileges on bank.* to ‘lrngsql’@’localhost’ identified by ‘xyz’;
    ERROR 1064 (42000): 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 ‘identified by ‘xyz” at line 1

    1. Hello Nigglestein – The code you’re using in the terminal may not apply to MySQL the way that you’re seeing it in your text. This may depend on the type of account that you have and the permissions you have for the MySQL database. The error does indicate a syntax issue. We would have to look directly at the code you used to see what’s wrong. You can also reference the command here: https://dev.mysql.com/doc/refman/8.0/en/grant.html. The easier way to apply ALL privileges per account is to create a MySQL database in cPanel. When you create the database, you will have an option to add the permissions to the user assigned to the account. (Create DB through cPanel: https://www.inmotionhosting.com/support/edu/cpanel/how-to-create-a-mysql-database-using-the-cpanel-api/).

  7. ALTER TABLE employees
    ADD CONSTRAINT `employees_cons_1` FOREIGN KEY (`reportsTo`) REFERENCES `employees` (`employeeNumber`),
    CONSTRAINT `employees_cons_2` FOREIGN KEY (`officeCode`) REFERENCES `offices` (`officeCode`);

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘CONSTRAINT `employees_cons_2` FOREIGN KEY (`officeCode`) REFERENCES `offices`…’ at line 3

    1. Your “Add Constraint” does not seem to be formatted correctly, typically it would be followed by a name such as:
      ADD CONSTRAINT name

      Here is a helpful link to some documentation on the ALTER TABLE statement, it provides some helpful examples.

  8. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”4846280,01-01-1978 )’ at line 1

    1. Hello Shmooke – Sorry for the problem with your MySQL(Maria DB) error. As the error states, it’s a syntax error, meaning that there’s a problem with either command or formatting of your code. Without the exact code, we can’t identify where the problem is located. We advise that you use a SQL code parser like the examples provided in the article. They will be able to help you narrow down where the error is occurring. Otherwise, you should speak with an experienced database programmer.

  9. no ,it has not touched my problem,and this is the problem below
    ERROR 1064 (42000): 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 ‘Keys’ at line 1
    i want to create a database and it is telling me that.

    1. Hi, Jacob! Sorry to hear that you’re running into trouble here. How exactly are you creating the database? Is this part of the installation of some software, or through cPanel’s database utility?

  10. I created a drop down list of states in the HTML form using data set present in the table named cool in my database in phpmyadmin. Names of states are present in the table “cool”. Now I created another table called “data” to store the user input values of name, address, contact and the email ID. I created a third table named “tab” which consists of ID and the stat columns to store the name of the state when the user selects from the drop down list. Now i tried joining tables “data” and “tab” using inner join in SQL. When I fetched the data and tried printing it in another web page , the name, email, contact and address are getting printed but the ID of the state in the table “cool” is getting printed instead of the name of state. I tried a lot to get the name of the state but always in vain.
    I request you to help me fix this problem and print the name of the state instead of it’s ID in the web page !!

    1. Hello Sravya,

      Your issue is a coding one with your database. We do not provide support for coding, so I recommend that you speak with an experienced developer or programmer. You can also find many tutorials for MySQL online that may provide the information you seek. Apologies that we cannot provide a direct solution for your issue.

      1. I get this error when trying to import a database to phpmyadmin

        Error

        Static analysis:

        3 errors were found during analysis.

        Variable name was expected. (near ” ” at position 5)
        Variable name was expected. (near ” ” at position 26)
        Unrecognized statement type. (near “Host” at position 0)

        SQL query: Copy

        Host: localhost (Version: 5.6.16) # Date: 2015-06-03 23:46:52 # Generator: MySQL-Front 5.3 (Build 4.122) /*!40101 SET NAMES utf8 */

        MySQL said: Documentation
        #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘Host: localhost (Version: 5.6.16)
        # Date: 2015-06-03 23:46:52
        # Generator: My’ at line 1

        phpmy admin seemingly has a problem with this:

        # Host: localhost (Version: 5.6.16)
        # Date: 2015-06-03 23:46:52
        # Generator: MySQL-Front 5.3 (Build 4.122)

        /*!40101 SET NAMES utf8 */;

      2. ERROR 1064 (42000) at line 6: 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 ‘

        <link rel' at line 1

        Operation failed with exitcode 1

      3. Hello, Saikat!

        It looks like there is an issue with how the query is coded. Unfortunately, we are unable to provide direct support for coding questions, so I recommend that you speak with an experienced developer or programmer. That said, I’d start by examining the early link syntax to see if it might be something simple like a missing comma or semi-colon. Apologies that we cannot provide a direct solution for your issue.

  11. Hi I got this error when trying to import mysql database into phpmyadmin using a local XAMPP server. Please what probably go wrong?

    Error:
    Static analysis:

    10 errors were found during analysis.

    Unexpected character. (near “{” at position 224)
    Unexpected beginning of statement. (near “DOCTYPE” at position 2)
    Unexpected beginning of statement. (near “HTML” at position 10)
    Unexpected beginning of statement. (near “html” at position 16)
    Unexpected beginning of statement. (near “lang” at position 21)
    Unexpected beginning of statement. (near “‘en'” at position 26)
    Unexpected beginning of statement. (near “dir” at position 31)
    Unexpected beginning of statement. (near “‘ltr'” at position 35)
    Unexpected beginning of statement. (near “meta” at position 42)
    Unrecognized statement type. (near “charset” at position 47)

    SQL query:

    html{display: none

    MySQL said: Documentation
    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘<meta name="ref' at line 1

    1. Hi Oluwatobi,

      The error indicates there is an issue with your syntax. This depends on your version of MySQL. I recommend that you review the documentation for the version of MySQL you are using to ensure you have the proper syntax in your code.

  12. Hey

    I got this error and I tried so many ways to fix it but I could not so can any one help me to figure it out !

    This is the error :

    Static analysis:

    1 errors were found during analysis.

    Unexpected beginning of statement. (near “id11897681_admin” at position 0)
    SQL query:

    id11897681_admin SET time_zone = “+00:00”

    MySQL said: Documentation

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘id11897681_admin
    SET time_zone = “+00:00″‘ at line 1

    1. Sorry for the problem that you’re getting with the SQL Syntax. I’m not 100% sure of the issue but it appears to be possible syntax near the ID you’re using. The documentation shows three backticks before the timezone. Check it out in the MariaDB’s official documentation: https://mariadb.com/kb/en/library/time-zones/.

    1. Please provide more information and we can look into the issue further. Describe where/when the error occurs and provide the query.

  13. Hello
    mysql error but Apache is running xampp is a problem ( Error: MySQL shutdown unexpectedly.
    This may be due to a blocked port, missing dependencies,
    improper privileges, a crash, or a shutdown by another method.
    Press the Logs button to view error logs and check
    the Windows Event Viewer for more clues
    If you need more help, copy and post this
    entire log window on the forums)

    Someone can help me.

    1. Hello – A MySQL shutdown can happen for any number of reasons. We would advise following the recommendation of using the log files to determine when the shutdown occurred and if the event can be duplicated. You may need to submit a ticket with our live technical support team, or you may need to speak with an experienced MySQL developer for further assistance. If you are getting a specific error due to Syntax, we would need more information on the MySQL query where the error is happening. If you have any further questions or comments, please let us know.

  14. Executing SQL script in server

    ERROR: Error 1064: 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 ‘(16) NOT NULL,

      `email` (255) NULL,

      `password` (32) NOT NULL,

      `create_time`’ at line 5

    SQL Code:

            — —————————————————–

            — Table `mydb`.`user_1`

            — —————————————————–

            CREATE TABLE IF NOT EXISTS `mydb`.`user_1` (

              `username` (16) NOT NULL,

              `email` (255) NULL,

              `password` (32) NOT NULL,

              `create_time`  NULL DEFAULT CURRENT_TIMESTAMP)

     

    SQL script execution finished: statements: 9 succeeded, 1 failed

     

    Fetching back view definitions in final form.

    Nothing to fetch

    Executing SQL script in server

    ERROR: Error 1064: 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 ‘(16) NOT NULL,

      `email` (255) NULL,

      `password` (32) NOT NULL,

      `create_time`’ at line 5

    SQL Code:

            — —————————————————–

            — Table `mydb`.`user_1`

            — —————————————————–

            CREATE TABLE IF NOT EXISTS `mydb`.`user_1` (

              `username` (16) NOT NULL,

              `email` (255) NULL,

              `password` (32) NOT NULL,

              `create_time`  NULL DEFAULT CURRENT_TIMESTAMP)

     

    SQL script execution finished: statements: 9 succeeded, 1 failed

     

    Fetching back view definitions in final form.

    Nothing to fetch

     

    1. Thanks for post on the MYSQL syntax error. The error indicates that the variable you’re building is not being properly defined. You need to indicated what each item is going to be. For example:

      CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
      species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);

      (From MySQL Reference)

      Specify what your variables are supposed to be in the table, then it should work.

  15. I am getting this error when using SQl Developer and trying to “monitor sessions” in a mysql database.  I can access the mysql database and look at tables, run queries, etc., and I have increased max_allowed_packets per a few other posts.  

    1. Sorry for the problem with the error when trying monitor sessions. We would need to see the MySQL query in order to troubleshoot the problem. Otherwise, we recommend speaking with an experienced database developer to resolve the issue.

    2. 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 ‘default(Cus_name,Rs_status,Acc_type,Acc_class,Currency,Init_deposit,Dob,Gender,M’ at line 1.
      this error how to solve plz help me

      1. Hello Sandar – sorry for the syntax error. We would need to see more of the MySQL query in order to determine the problem. I would recommend that you speak with an experienced developer or review your code to find the syntax issue that is causing the error to appear.

  16. hello I’am getting an error through my workbench while I’m trying to forward engineer.

     

    SQL Code:

            CREATE TABLE IF NOT EXISTS `electronics`.`customer_order` (

              `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,

              `amount` DECIMAL(6,2) NOT NULL,

              `date_created` TIMESTAMP NOT NULL,

              `confirmation_number` INT NOT NULL,

              `customer_id` INT UNSIGNED NOT NULL,

              PRIMARY KEY (`id`),

              INDEX `fk_customer_order_customer` (`customer_id` ASC) VISIBLE,

              CONSTRAINT `fk_customer_order_customer1`

                FOREIGN KEY (`customer_id`)

                REFERENCES `electronics`.`customer` (`id`)

                ON DELETE NO ACTION

                ON UPDATE NO ACTION)

            ENGINE = InnoDB

            COMMENT = ‘Maintain the details of the customer order’

     

    SQL script execution finished: statements: 9 succeeded, 1 failed

    End the error is

    ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘

      CONSTRAINT `fk_customer_order_customer1`

        FOREIGN KEY (`customer_id`)

        ‘ at line 8

     

  17. when i import a database from wamp i get an error that ther is an error in line one

    line 1 is 

    create databse student_mgt charset utf-8;

    connect student_mgt;

     

    1. Depends on how you’re doing the import. If you’re logged into WAMP and you have already created that database, then that line would not be needed and you can just import the structure. If you have any further questions or comments, please let us know.

  18. hii there ,,

    for the following database im getting these errors, could you please help me encounter teh errors.

    <?php
    $c_album=”CREATE TABLE IF NOT EXISTS album (
      aid int(11) NOT NULL auto_increment,
      aperformer_id int(11) NOT NULL default ‘0’,
      aname varchar(200) NOT NULL,
      bio_short text,
      bio_long text,
      PRIMARY KEY  (aid),
      KEY aperformer_id (aperformer_id),
      KEY aname (aname)
    ) ENGINE=MyISAM;”;

    $c_fav=”CREATE TABLE IF NOT EXISTS fav (
      id int(11) NOT NULL auto_increment,
      track_id int(11) NOT NULL default ‘0’,
      performer_id int(11) default NULL,
      album_id int(11) default NULL,
      name varchar(200) NOT NULL,
      duration varchar(6) default NULL,
      last_played varchar(20) default NULL,
      times_played int(11) NOT NULL default ‘0’,
      year varchar(4) default NULL,
      user_id int(11) NOT NULL default ‘0’,
      fav_name varchar(80) NOT NULL default ”,
      PRIMARY KEY  (id),
      KEY fav_name (fav_name),
      KEY user_id (user_id),
      KEY track_id (track_id)
    ) ENGINE=MyISAM;”;

    $c_fav_shares=”CREATE TABLE IF NOT EXISTS fav_shares (
      id int(11) NOT NULL auto_increment,
      owner_id int(11) NOT NULL default ‘0’,
      fav_name varchar(80) NOT NULL,
      share_id int(11) NOT NULL default ‘0’,
      PRIMARY KEY  (id)
    ) ENGINE=MyISAM”;

    $c_performer=”CREATE TABLE IF NOT EXISTS performer (
      pid int(11) NOT NULL auto_increment,
      pname varchar(200) NOT NULL,
      bio_short text,
      bio_long text,
      PRIMARY KEY  (pid),
      KEY pname (pname)
    ) ENGINE=MyISAM;”;

    $c_queue=”CREATE TABLE IF NOT EXISTS queue (
      qid bigint(20) NOT NULL auto_increment,
      user_name varchar(80) NOT NULL,
      track_id bigint(20) NOT NULL default ‘0’,
      PRIMARY KEY  (qid),
      KEY user_name (user_name)
    ) ENGINE=MyISAM;”;

    $c_track=”CREATE TABLE IF NOT EXISTS `track` (
      `id` bigint(20) NOT NULL AUTO_INCREMENT,
      `performer_id` int(11) DEFAULT NULL,
      `album_id` int(11) DEFAULT NULL,
      `track_no` smallint(6) DEFAULT NULL,
      `name` varchar(200) NOT NULL,
      `duration` varchar(6) DEFAULT NULL,
      `last_played` varchar(20) DEFAULT NULL,
      `times_played` int(11) NOT NULL DEFAULT ‘0’,
      `year` varchar(4) DEFAULT NULL,
      `path` text COLLATE latin1_danish_ci,
      `echonest_id` varchar(20) NOT NULL DEFAULT ‘-1’,
      `echonest_tempo` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_loudness` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_danceability` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_energy` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_mode` varchar(2) NOT NULL DEFAULT ‘-1’,
      `echonest_key` varchar(2) NOT NULL DEFAULT ‘-1’,
      `echonest_time_signature` varchar(2) NOT NULL DEFAULT ‘-1’,
      `echonest_status` varchar(10) NOT NULL DEFAULT ‘-1’,
      `echonest_liveness` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_speechiness` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_acousticness` varchar(8) NOT NULL DEFAULT ‘-1’,
      `echonest_valence` varchar(8) NOT NULL DEFAULT ‘-1’,
      PRIMARY KEY (`id`),
      KEY `performer_id` (`performer_id`),
      KEY `album_id` (`album_id`),
      KEY `name` (`name`),
      KEY `year` (`year`),
      KEY `echonest_tempo` (`echonest_tempo`),
      KEY `echonest_loudness` (`echonest_loudness`),
      KEY `echonest_danceability` (`echonest_danceability`),
      KEY `echonest_energy` (`echonest_energy`),
      KEY `echonest_mode` (`echonest_mode`),
      KEY `echonest_key` (`echonest_key`),
      KEY `echonest_time_signature` (`echonest_time_signature`),
      KEY `echonest_liveness` (`echonest_liveness`),
      KEY `echonest_speechiness` (`echonest_speechiness`),
      KEY `echonest_acousticness` (`echonest_acousticness`),
      KEY `echonest_valence` (`echonest_valence`)
    ) ENGINE=MyISAM;”;

    $c_user=”CREATE TABLE IF NOT EXISTS `user` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(80) NOT NULL,
      `email` varchar(80) NOT NULL DEFAULT ‘0’, 
      `password` varchar(80) NOT NULL,
      `password_salt` varchar(40) NOT NULL DEFAULT ‘0’,
      `last_login` varchar(40) NOT NULL DEFAULT ”,
      `last_ip` varchar(40) NOT NULL DEFAULT ”,
      `admin` tinytext NOT NULL,
      `lang` char(2) NOT NULL DEFAULT ”,
      `count` mediumint(9) NOT NULL DEFAULT ‘0’,
      `enqueue` char(1) DEFAULT ‘0’,
      `cssfile` varchar(80) NOT NULL DEFAULT ”,
      `icon_dir` varchar(80) DEFAULT NULL,
      `disp_last_played` char(1) DEFAULT ‘1’,
      `disp_times_played` char(1) DEFAULT ‘1’,
      `disp_id_numbers` char(1) DEFAULT ‘1’,
      `disp_jump_to` char(1) DEFAULT ‘1’,
      `disp_duration` char(1) DEFAULT ‘1’,
      `disp_totals` char(1) DEFAULT ‘1’,
      `disp_related_performers` char(1) DEFAULT ‘1’,
      `confirm_delete` char(1) DEFAULT ‘1’,
      `can_download` char(1) DEFAULT ‘0’,
      `can_upload` char(1) DEFAULT ‘0’,
      `disp_download` char(1) DEFAULT ‘0’,
      `disp_upload` char(1) DEFAULT ‘0’,
      `disp_lyrics` char(1) DEFAULT ‘0’,
      `hide_icon_text` char(1) NOT NULL DEFAULT ‘0’,
      `disp_fav_shares` char(1) DEFAULT ‘0’,
      `disp_small_images` char(1) DEFAULT ‘1’,
      `browse_albums_by_covers` char(1) DEFAULT ‘0’,
      `browse_performer_by_picture` char(1) DEFAULT ‘0’,
      `autoplay` char(1) DEFAULT ‘0’,
      `autoplay_num_tracks` int(11) NOT NULL DEFAULT ‘1’,
      `autoplay_list` varchar(80) DEFAULT ‘Tracks’,
      `autoplay_last` char(1) DEFAULT ‘0’,
      `autoplay_last_list` varchar(80) DEFAULT NULL,
      `ask4favoritelist` char(1) DEFAULT ‘0’,
      `ask4favoritelist_disp_suggestion` char(1) NOT NULL DEFAULT ‘0’,
      `disp_now_playing` char(1) DEFAULT ‘0’,
      `disp_now_playing_add2favorite` char(1) NOT NULL DEFAULT ‘0’,
      `avoid_duplicate_entries` char(1) DEFAULT ‘1’,
      `auto_add2favorite` char(1) NOT NULL DEFAULT ‘0’,
      `auto_add2favorite_create_new` char(1) NOT NULL DEFAULT ‘1’,
      `auto_add2favorite_prefix` varchar(50) NOT NULL DEFAULT ‘AmpJuke_Automatically_added’,
      `disp_help` char(1) DEFAULT ‘1’,
      `welcome_num_items` smallint(6) NOT NULL DEFAULT ’10’,
      `welcome_content_1` varchar(80) DEFAULT ‘Recently played tracks’,
      `welcome_content_2` varchar(80) DEFAULT ‘Random albums’,
      `welcome_content_3` varchar(80) DEFAULT ‘Random albums’,
      `lame_local_enabled` char(1) DEFAULT ‘1’,
      `lame_local_parameters` varchar(80) DEFAULT NULL,
      `lastfm_active` char(1) DEFAULT ‘0’,
      `lastfm_username` varchar(80) DEFAULT NULL,
      `lastfm_password` varchar(80) DEFAULT NULL,
      `xspf_active` char(1) NOT NULL DEFAULT ‘0’,
      PRIMARY KEY (`id`),
      KEY `name` (`name`),
      KEY `password` (`password`)
    ) ENGINE=MyISAM;”;

    ?>
    here are the errors :

    Static analysis:

    7 errors were found during analysis.

     

    1. Unexpected character. (near “?” at position 1)
    2. Unexpected character. (near “$” at position 7)
    3. Unexpected beginning of statement. (near “?” at position 1)
    4. Unexpected beginning of statement. (near “php” at position 2)
    5. Unexpected beginning of statement. (near “$” at position 7)
    6. Unexpected beginning of statement. (near “c_album” at position 8)
    7. Unexpected beginning of statement. (near “”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto_increment, aperformer_id int(11) NOT NULL default ‘0’, aname varchar(200) NOT NULL, bio_short text, bio_long text, PRIMARY KEY (aid), KEY aperformer_id (aperformer_id), KEY aname (aname) ) ENGINE=MyISAM;”” at position 16)

     

    SQL query:

     

    <?php $c_album=”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto_increment, aperformer_id int(11) NOT NULL default ‘0’, aname varchar(200) NOT NULL, bio_short text, bio_long text, PRIMARY KEY (aid), KEY aperformer_id (aperformer_id), KEY aname (aname) ) ENGINE=MyISAM;”

     

    MySQL said:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<?php
    $c_album="CREATE TABLE IF NOT EXISTS album (
      aid int(11) NOT NULL auto' at line 1h

    thank youu

  19. hii there ,, for the following database I am getting some errors,

    these are the errors .. would you please help me in encountering these errors. Static analysis: 7 errors were found during analysis. Unexpected character. (near “?” at position 1) Unexpected character. (near “$” at position 7) Unexpected beginning of statement. (near “?” at position 1) Unexpected beginning of statement. (near “php” at position 2) Unexpected beginning of statement. (near “$” at position 7) Unexpected beginning of statement. (near “c_album” at position 8) Unexpected beginning of statement. (near “”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto_increment, aperformer_id int(11) NOT NULL default ‘0’, aname varchar(200) NOT NULL, bio_short text, bio_long text, PRIMARY KEY (aid), KEY aperformer_id (aperformer_id), KEY aname (aname) ) ENGINE=MyISAM;”” at position 16) SQL query: <?php $c_album=”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto_increment, aperformer_id int(11) NOT NULL default ‘0’, aname varchar(200) NOT NULL, bio_short text, bio_long text, PRIMARY KEY (aid), KEY aperformer_id (aperformer_id), KEY aname (aname) ) ENGINE=MyISAM;” MySQL said: #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘<?php $c_album=”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto’ at line 1

    1. Hello,

      In order to troubleshoot this issue, we would need to see the actual query. Also, I looked for examples of the “unexpected beginning of statement” error and found that it’s possible syntax issues that are typically caused by missed quotes, misspelled keywords, or other necessary punctuation. Make sure to check your code for that kind of issue. We do not normally provide coding support, so you may need to speak with an experienced database programmer if you require assistance with determining how to code your query.

    2. I replied to your earlier post not knowing that you had posted everything below. Please bear in mind that your main issue has to do with using a mysql query in PHP – so you need to look at that format for doing that kind of thing in order to get the syntax correct. If you want to see the proper documentation, then please see: the code here. We can look at MySQL queries and point out syntax errors and provide possible solutions, but we, unfortunately, cannot provide coding support for you as that is beyond our scope of support.

  20. hi i am getting this error can any one help me.

    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 ‘where profileid=’24” at line 1

    1. Hello sorry for the problem with the SQL error. Unfortunately, without your full SQL query, we won’t be able to investigate the problem. Please include the SQL query and we can look into the issue further. Otherwise, we recommend that you work with a database developer to resolve the problem.

  21. Hi everyone,

    i have this issue when i try to write a trigger on mysq.

    create trigger TR_Worklog

    BEFORE INSERT On `total_worklog_bogota`

    FOR EACH ROW

    BEGIN
    insert into `total_worklog_bogota` (Request_id, Requester ,Subject ,Time_Spent_Created_Time  ,Time_Spent_Technician ,Time_Spent ,Site ,Request_Status ,Created_Time ,Resolved_Time ,Completed_Time ,Client)
    VALUES(NEW.Request_id ,NEW.Requester,NEW.Subject ,NEW.Time_Spent_Created_Time  , NEW.Time_Spent_Technician ,NEW.Time_Spent ,NEW.Site ,NEW.Request_Status ,NEW.Created_Time ,NEW.Resolved_Time ,NEW.Completed_Time ,NEW.Client)
    WHERE
    total_worklog_bogota.Request_id <> NEW.Request_id and total_worklog_bogota.Time_Spent_Technician <> NEW.Time_Spent_Technician and total_worklog_bogota.Time_Spent <> NEW.Time_Spent
    END

    and when i run the trigger shows the error 1064 and i don´t know where is the mistake.

    if someone could helpme pliss

    1. I suggest that you review the documentation for the version of MySQL that you are using this code with. Comparing your code to the syntax provided in the documentation should help diagnose the issue and easily determine the correction to be made to fix it.

  22. Estou tentando gerar uma e esta ocorrendo erro:

    CREATE TABLE `ocpv_description`; ADD `size_chart` TEXT NOT NULL;

     

    CREATE ALTER TABLE `ocpv_option_value` ADD `default_option` TINYINT(1) NOT NULL DEFAULT ‘0’;

     

     

    Static analysis:

    1 errors were found during analysis.

     

    1. The name of the entity was expected. (near “ALTER” at position 7)

     

    Comando SQL:

    CREATE ALTER TABLE `ocpv_description` ADD `size_chart` TEXT NOT NULL

    #1064 - Você tem um erro de sintaxe no seu SQL próximo a 'ALTER TABLE `ocpv_description` ADD `size_chart` TEXT NOT NULL' na linha 1

    1. I am unable to troubleshoot your database syntax errors. You will need to review the documentation for the version of MySQL that you are having this error appear with and your syntax to fix the problem.

  23. Greetings, Im trying to make a simple one to many ERD.

    Here is the SQL script I have

     

    — MySQL Workbench Forward Engineering

     

    SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;

    SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

    SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’TRADITIONAL,ALLOW_INVALID_DATES’;

     

    — —————————————————–

    — Schema quoting_dojos

    — —————————————————–

     

    — —————————————————–

    — Schema quoting_dojos

    — —————————————————–

    CREATE SCHEMA IF NOT EXISTS `quoting_dojos` DEFAULT CHARACTER SET utf8 ;

    USE `quoting_dojos` ;

     

    — —————————————————–

    — Table `quoting_dojos`.`users`

    — —————————————————–

    CREATE TABLE IF NOT EXISTS `quoting_dojos`.`users` (

      `id` INT NOT NULL AUTO_INCREMENT,

      `name` VARCHAR(45) NULL,

      `created_at` DATETIME NULL,

      `updated_at` DATETIME NULL,

      PRIMARY KEY (`id`))

    ENGINE = InnoDB;

     

     

    — —————————————————–

    — Table `quoting_dojos`.`quotes`

    — —————————————————–

    CREATE TABLE IF NOT EXISTS `quoting_dojos`.`quotes` (

      `id` INT NOT NULL AUTO_INCREMENT,

      `users_id` INT NULL,

      `quote` TEXT NULL,

      `created_at` DATETIME NULL,

      `updated_at` DATETIME NULL,

      PRIMARY KEY (`id`),

      INDEX `fk_quotes_users_idx` (`users_id` ASC) VISIBLE,

      CONSTRAINT `fk_quotes_users`

        FOREIGN KEY (`users_id`)

        REFERENCES `quoting_dojos`.`users` (`id`)

        ON DELETE NO ACTION

        ON UPDATE NO ACTION)

    ENGINE = InnoDB;

     

     

    SET SQL_MODE=@OLD_SQL_MODE;

    SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

    SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

     

    Then the errror….

    Executing SQL script in server

    ERROR: Error 1064: 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 ‘VISIBLE,

      CONSTRAINT `fk_quotes_users`

        FOREIGN KEY (`users_id`)

        REFEREN’ at line 11

    SQL Code:

            — —————————————————–

            — Table `quoting_dojos`.`quotes`

            — —————————————————–

            CREATE TABLE IF NOT EXISTS `quoting_dojos`.`quotes` (

              `id` INT NOT NULL AUTO_INCREMENT,

              `users_id` INT NULL,

              `quote` TEXT NULL,

              `created_at` DATETIME NULL,

              `updated_at` DATETIME NULL,

              PRIMARY KEY (`id`),

              INDEX `fk_quotes_users_idx` (`users_id` ASC) VISIBLE,

              CONSTRAINT `fk_quotes_users`

     

                FOREIGN KEY (`users_id`)

                REFERENCES `quoting_dojos`.`users` (`id`)

                ON DELETE NO ACTION

                ON UPDATE NO ACTION)

            ENGINE = InnoDB

     

    I am perplexed on what the issue is.

     

    I did upgrade from MySQL workbench 6.3 to 8.0 if they makes any difference

     

    Thanks for any help

     

    1. You’ll want to ensure the syntax codes match the version of MySQL you’re using. I recommend cross-checking your MySQL code against SQL syntax checker such as Piliapp MySQL Syntax Check orHive SQL Syntax Checker to help with revisions. MySQL Support may also be of assistance for ways to do this within the program.

  24. hello

    i have an error to insert data in table

    error is like..

    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘Name,Cast,Address,Taluka,District,Pincode,Nationality ,Gender,Date Of Birth,Mobi’ at line 1

     

    i am using this->xampp-win32-7.2.7-0-VC15-installer

    so how can i fix it

  25. I cant make a call from python to a mysql procedure that contains a prepared statement. The sql procedure works like a charm when called from a mysql workbench sql editor. Does python mysql.connector support calling procedure that calls prepare and execute statement ?

    The error in python is : leads to mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax, and it is proved that just commenting the prepare and execute line in the mysql script does eliminate the error (but of course neither it preforms the procedure as required…)

    SQL:

    CREATE PROCEDURE myProc()

    BEGIN

    call deleteDependency(CONCAT(‘delete from ‘, dependency_table,’ where ‘, dependency_field , ‘ = ( SELECT ‘, dependency_reference_field ,’ from GlobalUser where id=’,_user_id ,’);’));

    END

    CREATE PROCEDURE deleteDependency(IN dltStmt TEXT)

    BEGIN

    set @dltDependency =  dltStmt;

    PREPARE stmt FROM @dltDependency;

            EXECUTE stmt; 

            DEALLOCATE PREPARE stmt; 

    END $$

    PYTHON: 

    conn = mysql.connector.connect(host=conf.host, port=int(conf.port), user=conf.user,passwd=conf.password, db=conf.database, charset=’utf8′, use_unicode=True, use_pure=True)

    cursor = conn.cursor()

    try:

      result_args = cursor.callproc(“my_proc”, [])

    except:

      raise

    finally:

        try:

           cursor.close()  # Cerrar el cursor

           conn.close()  # Cerrar la conexion

        except:

           pass

     

  26. CREATE TABLE "employee" (id INT(10),emp_name VARCHAR(50),salary DOUBLE(50),company VARCHAR(20),address VARCHAR(20));

    ERROR 1064 (42000): 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 ‘”employee” (id INT(10),emp_name VARCHAR(50),salary DOUBLE(50),company VARCHAR(20’ at line 1

     

    ???????????? 

     

     

    1. Hello,

      Thanks for the question about your MySQL syntax code error. The problem has to do with the use of DOUBLE (50) in the creation of your table. Check out the documentation for the value here. If you have any further question then you may need to speak with an experienced database developer in order to make sure that your query is error-free.

  27. how to set foreign key in child table

    My error

    create table product_details(

        id_1 int NOT NULL PRIMARY KEY,

        productname varchar(30),

        description varchar(30),

        amount varchar(30),

        id int FOREIGN KEY REFERENCES multiple(id)

        );

     

     #1064 – 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 ”FOREIGN KEY’ REFERENCES multiple(id) )’ at line 6

    how do slove it.

    1. As the error indicates there is an issue with your syntax. This depends on your version of MySQL. Although I am not able to provide the code to resolve the issue with your code, I recommend (as the error indicates) that you review the documentation for the version of MySQL you are using to ensure you have proper syntax in your code.

  28.  $id=1;

        $name=’aycha’;

        $email=’[email protected]’;

    $dbh = new PDO(‘mysql:host=localhost;dbname=user_data’, ‘root’, ”);

            if($dbh)

            {

                echo ‘conected’;

            }

            else{

                echo ‘not’;

            }

    try {

    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

     

      $dbh->beginTransaction();

    $sth = $dbh->exec(“INSERT INTO user_data(id,name,email) VALUES ($id,$name,$email)”);

      }

            catch(Exception $e){

                $dbh->rollBack();

      echo “Failed: ” . $e->getMessage();

    }

    why it gives me this error 

     Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use 

    1. That is not MySQL, it’s PHP code. We would need to see the MySQL query to troubleshoot. The error is related to the query. You will need to speak with a developer for assistance with PHP issues.

  29. Hello,

    Does MySQL 8.0 support the command REVOKE with CASCADE? I read th MySQL manual and it does not refer this command anywhere.

  30. Hello, 
    I would like to ask you something. When I write this command:
    REVOKE SELECT ON emp FROM D CASCADE;
    the system returns:
    MySQL said:
    #1064 - 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 'CASCADE' at line 1
    Do you have any idea why this is happening?
    Thank you!

  31. When I typing php code I receive this error:

    Query failed with error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘) ORDER BY name ASC’ at line 1

    Anybody can help me, please?. Thank you very much.

    1. We would need to see the actual MySQL query that is being made in order to provide assistance. Pleae provide more information and we can investigate the issue in more depth.

  32. I get this error when i mwant to update records in my table:

    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘Efternavn = ‘Handler’, Adresse = ‘Bredgade 21 1 Tv’, PostNr = ‘4000’, Bynavn = ‘ at line 1

     

    Here is my code:

    <?php //include config
    require_once(‘../includes/config.php’);

    //if not logged in redirect to login page
    if(!$user->is_logged_in()){ header(‘Location: login.php’); }
    ?>

    <!doctype html>
    <html lang=”da”>
    <head>
      <meta charset=”utf-8″>
      <title>Medlemmer</title>
     <link rel=”stylesheet” href=”../style/normalize.css”>
      <link rel=”stylesheet” href=”../style/main.css”>
    </head>

    <body>

     

    <div id=”wrapper”>

     <?php include(‘menu_1.php’);?>
     <p><a href=”member.php”>Medlems Index</a></p>

     <h2>Ret medlem</h2>

     <?php

     //if form has been submitted process it
     if(isset($_POST[‘submit’])){

      //collect form data
      extract($_POST);

      //very basic validation
      if($Have_Nr ==”){
       $error[] = ‘Indtast havenummer.’;
      }

       if($Medlems_Nr ==”){
        $error[] = ‘Indtast medlemsnummer.’;
       }

       if($Fornavn ==”){
        $error[] = ‘Indtast fornavn.’;
       }

       if($Efternavn ==”){
        $error[] = ‘Indtast efternavn.’;
       }
       
       if($Adresse ==”){
       $error[] = ‘Indtast adresse.’;
      }

       if($PostNr ==”){
        $error[] = ‘Indtast postnummer.’;
       }

       if($Bynavn ==”){
        $error[] = ‘Indtast bynavn.’;
       }

       if($Email ==”){
        $error[] = ‘Indtast email.’;
       }   

      if($Telefon ==”){
       $error[] = ‘Indtast telefonnummer.’;
      }
      
      
       if($TelefonHaven ==”){
        $error[] = ‘Indtast telefonnummer i haven.’;
       }   

      if($Start_Dato ==”){
       $error[] = ‘Indtast dato.’;
      }

      if(!isset($error)){

       try {

        if(isset($error)){

         /*$hashedpassword = $user->password_hash($password, PASSWORD_BCRYPT);*/

         //update into database
         $stmt = $db->prepare(‘UPDATE medlemmer SET Have_Nr = :Have_Nr, Medlems_Nr = :Medlems_Nr, Fornavn = :Fornavn Efternavn = :Efternavn, Adresse = :Adresse, PostNr = :PostNr, Bynavn = :Bynavn, Email = :Email, Telefon = :Telefon, TelefonHaven = :TelefonHaven, Start_Dato = :Start_Dato WHERE memberID = :memberID’) ;
         $stmt->execute(array(
          ‘:Have_Nr’ => $Have_Nr,
          ‘:Medlems_Nr’ => $Medlems_Nr,
          ‘:Fornavn’ => $Fornavn,
          ‘:Efternavn’ => $Efternavn,
          ‘:Adresse’ => $Adresse,
          ‘:PostNr’ => $PostNr,
          ‘:Bynavn’ => $Bynavn,
          ‘:Email’ => $Email,
          ‘:Telefon’ => $Telefon,
          ‘:TelefonHaven’ => $TelefonHaven,
          ‘:Start_Dato’ => $Start_Dato,
          ‘:memberID’ => $memberID
         ));

        } else {

         //update database
         $stmt = $db->prepare(‘UPDATE medlemmer SET Have_Nr = :Have_Nr, Medlems_Nr = :Medlems_Nr, Fornavn = :Fornavn Efternavn = :Efternavn, Adresse = :Adresse, PostNr = :PostNr, Bynavn = :Bynavn, Email = :Email, Telefon = :Telefon, TelefonHaven = :TelefonHaven, Start_Dato = :Start_Dato WHERE memberID = :memberID’) ;
         $stmt->execute(array(
          ‘:Have_Nr’ => $Have_Nr,
          ‘:Medlems_Nr’ => $Medlems_Nr,
          ‘:Fornavn’ => $Fornavn,
          ‘:Efternavn’ => $Efternavn,
          ‘:Adresse’ => $Adresse,
          ‘:PostNr’ => $PostNr,
          ‘:Bynavn’ => $Bynavn,
          ‘:Email’ => $Email,
          ‘:Telefon’ => $Telefon,
          ‘:TelefonHaven’ => $TelefonHaven,
          ‘:Start_Dato’ => $Start_Dato,
          ‘:memberID’ => $memberID
         ));

        }
        

        //redirect to index page
        header(‘Location: member.php?action=updated’);
        exit;

       } catch(PDOException $e) {
           echo $e->getMessage();
       }

      }

     }

     ?>

     <?php
     //check for any errors
     if(isset($error)){
      foreach($error as $error){
       echo $error.'<br />’;
      }
     }

      try {

       $stmt = $db->prepare(‘SELECT memberID,  Have_Nr, Medlems_Nr, Fornavn, Efternavn, Adresse, PostNr, Bynavn, Email, Telefon, TelefonHaven, Start_Dato FROM medlemmer WHERE memberID = :memberID’) ;
       $stmt->execute(array(‘:memberID’ => $_GET[‘id’]));
       $row = $stmt->fetch();
       

      } catch(PDOException $e) {
          echo $e->getMessage();
      }

     ?>

     <form action=” method=’post’>
      <input type=’hidden’ name=’memberID’ value='<?php echo $row[‘memberID’];?>’>

      <p><label>Have Nr.</label><br />
      <input type=’int’ name=’Have_Nr’ value='<?php echo $row[‘Have_Nr’];?>’></p>
      
      <p><label>Medlems Nr.</label><br />
      <input type=’int’ name=’Medlems_Nr’ value='<?php echo $row[‘Medlems_Nr’];?>’></p>

      <p><label>Fornavn</label><br />
      <input type=’text’ name=’Fornavn’ value='<?php echo $row[‘Fornavn’];?>’></p>

       <p><label>Efternavnr.</label><br />
      <input type=’text’ name=’Efternavn’ value='<?php echo $row[‘Efternavn’];?>’></p>

      <p><label>Adresse</label><br />
      <input type=’text’ name=’Adresse’ value='<?php echo $row[‘Adresse’];?>’></p>

      <p><label>Post Nr.</label><br />
      <input type=’int’ name=’PostNr’ value='<?php echo $row[‘PostNr’];?>’></p>
      
      <p><label>Bynavn</label><br />
      <input type=’text’ name=’Bynavn’ value='<?php echo $row[‘Bynavn’];?>’></p>
      
      <p><label>Email</label><br />
      <input type=’text’ name=’Email’ value='<?php echo $row[‘Email’];?>’></p>

      <p><label>Telefon</label><br />
      <input type=’int’ name=’Telefon’ value='<?php echo $row[‘Telefon’];?>’></p>
      
      <p><label>Telefon i haven</label><br />
      <input type=’int’ name=’TelefonHaven’ value='<?php echo $row[‘TelefonHaven’];?>’></p>
      
      <p><label>Start Dato</label><br />
      <input type=’date’ name=’Start_Dato’ value='<?php echo $row[‘Start_Dato’];?>’></p>
      
      <p><input type=’submit’ name=’submit’ value=’Opdater medlem’></p>

     </form>

    </div>
     
     </body>
    </html>

     

    Could you please help 

    Best regards

    1. I would recommend enabling the MySQL general log so you can see the exact query as it is being passed to MySQL to determine where the syntax error is.

  33. A 1064 error is generally in issue with your syntax, which means that you need to double check the command you’re using for the section where the error is being identified. If you’re not familiar with it, then it’s best to seek an experienced programmer who can identify not only your problem, but the best way to fix the issue. We can point out a possible solution, but it may not be the best way to handle the problem. Your code is apparently using “DEFAULT CHARACTER SET” which appears to be the problem. Please see this documentation directly from the MySQL website for proper use of “character set”.

  34. A Database Error Occurred
    Error Number: 1064
    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘SET `last_activity` = 1513748191, `user_data` = ‘a:2:{s:9:\”user_data\”;s:0:\”\”‘ at line 1
    UPDATE SET `last_activity` = 1513748191, `user_data` = ‘a:2:{s:9:\”user_data\”;s:0:\”\”;s:2:\”id\”;s:1:\”1\”;}’ WHERE `session_id` = ‘e04496ac560aa0dd6cf2a952154ce474’
    Filename: C:/xampp/htdocs/CodeIgniter/system/database/DB_driver.php
    Line Number: 691

    1. The error is occurring because a table is normally declared BEFORE you use SET. If you don’t know how to properly write that statement, then consult with an experienced database programmer or review the syntax in a reference such as this MYSQL: Update syntax.

  35. Hi, I’ve got the same kind of troube with a classic SQL query on Prestashop :

    ALTER TABLE `ps_order_detail`
      ADD PRIMARY KEY (`id_order_detail`),
      ADD KEY `order_detail_order` (`id_order`),
      ADD KEY `product_id` (`product_id`),
      ADD KEY `product_attribute_id` (`product_attribute_id`),
      ADD KEY `id_order_id_order_detail` (`id_order`,`id_order_detail`),
      ADD KEY `id_shop` (`id_shop`),
      ADD KEY `id_tax_rules_group` (`id_tax_rules_group`);

     

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ALTER TABLE `ps_order_detail`
      ADD PRIMARY KEY (`id_order_detail`),
      ADD KEY' at line 1811

     

    I’ve tried without the backticksbut nor result… Is there an other way to try to solve it ?

    Thanks,

    Arnaud

    1. Hello,

      I created a table with the columns in your query and ran it and the query ran without issue. I ran the command directly in MySQL, if you are using a php script to execute this script i would recommend using a PDO prepared statement to ensure everything is being passed to your MySQL server as it should, You can find more information about PDO prepared statements here.

  36. sql error

    phpMyAdmin SQL Dump
    -- version 4.0.10.18
    -- https://www.phpmyadmin.net
    --
    -- Host: localhost:3306
    -- Generation Time: Sep 01, 2017 at 12:33 AM
    -- Server version: 5.6.36-cll-lve
    -- PHP Version: 5.6.30
    
    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    

    MySQL said:

    #1064 - 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 'phpMyAdmin SQL Dump

     

    I faced this error when i try to upload database in phpmy admin please guide me how to solve this kind of error

     

    1. If you are attempting to import the database via phpMyAdmin the issue may be resolved by following the steps in this our guide regarding MySQL 1044 Access Denied Error. This is the syntax that usually causes issues, as outlined in the guide at the link above:

      -- PHP Version: 5.2.6
      SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
      CREATE DATABASE employees;
      -- --------------------------------------------------------

      Otherwise, if commenting out that line does not correct the error, you may need to perform an export of the database, ensuring there are no errors and then attempt to import that new backup. I hope this helps!

  37. Guys! it was simply working until yesterday! now out of the below it stopped?? and showng errors?

    mySQL query error: SELECT count(*) as rows FROM ibf_sessions WHERE running_time > 1511391245

    SQL error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘rows FROM ibf_sessions WHERE running_time > 1511391245’ at line 1
    SQL error code: 1064
    Date: Wednesday 22nd November 2017 11:09:05 PM

     ———————————————————————————————————————————————————————————-
     Date: Wed, 22 Nov 2017 23:09:05 +0000
     Error: 1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘rows FROM ibf_sessions WHERE running_time > 1511391245’ at line 1
     IP Address: 176.***.196.177 – /admin/
     ———————————————————————————————————————————————————————————-
     mySQL query error: SELECT count(*) as rows FROM ibf_sessions WHERE running_time > 1511391245
     .——————————————————————————————————————————————————————————–.
     | File                                                                       | Function                                                                      | Line No.          |
     |—————————————————————————-+——————————————————————————-+——————-|
     | admin/sources/base/ipsController.php                                       | [admin_core_mycp_dashboard].doExecute                                         | 306               |
     ‘—————————————————————————-+——————————————————————————-+——————-‘

    1. Ensure you have a semicolon at the end of this line:
      SELECT count(*) as rows FROM ibf_sessions

      Also, here is a helpful link to an online guide on the SQL Select Statement. It provides additional examples.

      Thank you,
      John-Paul

  38. (“SELECT c.Data_ID, c.Lead__c, c.Opportunity__c, c.Project__c,c.`Account Name`,c.`Account Number`,c.`Opportunity Owner`,c.`Opportunity Owner Manager`,c.`Opportunity Owner Department`,”

    “c.`Opportunity Owner Division`,c.`Lead Created Date`,c.`Opportunity Created Date`,c.`Qualification Date`,c.`First Solution Review Date`,c.`Last Solution Review Date`,c.`First Solution Review Held Date`,c.`Last Solution Review Held Date`,”

    “c.`Sale Date`,c.`Original Lead Source`,c.`Original Referral Code`,c.`Original Marketing Channel`,c.`Original Marketing Partner`,c.`Lead Source`,c.`Referral Code`,c.`Marketing Channel`,”

    “c.`Marketing Partner`,c.`Lead Status`,c.`Lead Status Detail`,c.`Opportunity Stage`,c.`Opportunity Stage Detail`,c.`Project Status`,c.`Project Phase`,c.`Project Phase Detail`,”

    “c.`Gross Sale`,c.`Net Sale`,c.Cancellation”

    “FROM analytics.customer as c;”)

    Gets me an “(1064, “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 ‘.customer as c’ at line 1″)” error please help!!!!

    This code works perfectly fine in mysql but crashes when running from a python script.

    1. From what the error is indicating, there is an issue with the code “FROM analytics.customer as c;” for the version of MySQL that you are running. Is it possible that Python is using an alternative module or version of MySQL that could be causing the different behavior/unexpected error? Also, if you are able to find the MySQL version you are using, you can typically determine the corrective action to take by reviewing their documentation online for that particular version. I hope this helps, feel free to comment and provide any additional details regarding the error and version(s). With that information we may be able to review this further for you.

  39. I am unable to figure out why I am getting this error message when trying to create a trigger in phpMyAdmin. Here is the SQL that I am trying to run:

     

    create trigger timeupdate after insert on posts

    for each row

    begin

    update threads set latestupdate = now() where threadid in 

    (select * from threads t, posts p where p.threadid = t.threadid and p.postid = last_insert_id());

    update boards set latestupdate = now() where categoryid in 

    (select * from boards b, thread t, posts p where p.postid = last_insert_id() and p.threadid = t.threadid and b.categorynumber = t.categorynumber);

    end;

     

    postid in the posts table is auto-incremented. posts table has a foreign key to the threads table via a threadid. Likewise, threads has a foreign key to the boards table via categorynumber. The error message says:

    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 ” at line 6 

     

    Line 6 is the line that starts with (select *) in the first update statement.

     

    Can anyone please help refine this statement? Thanks!

  40. I keep getting a syntax error from line 1 

    CREATE TABLE Car Dealer
    (
    LicensePlate varchar not null,
    PickUpDate integer not null,
    OfficeName varchar not null,
    time_id integer not null,
    Risk integer not null,
    Amount integer not null,
    Discount integer not null,
    PRIMARY KEY (LicensePlate,PickUpDate,OfficeName, time_id,Risk),
    FOREIGN KEY(LicensePlate) REFERENCES Rentals (LicensePlate),
    FOREIGN KEY (Location) REFERENCES Sales (LicensePlate),
    FOREIGN KEY (DroffOffDate) REFERENCES Rentals (LicensePlate),
    FOREIGN KEY (PickUpPlace) REFERENCES Rentals (LicensePlate),
    FOREIGN KEY (DropOffPlace) REFERENCES Rentals (LicensePlate),
    FOREIGN KEY (PickUpDate) REFERENCES Rentals (PickUpDate),
    FOREIGN KEY (LicensePlate) REFERENCES Cars (LicensePlate),
    FOREIGN KEY (LicensePlate) REFERENCES Insurance (LicensePlate),
    FOREIGN KEY (LicensePlate) REFERENCES Sales (LicensePlate),
    FOREIGN KEY (PickUpDate) REFERENCES Insurance (PickUpDate)
    );

    1. Can you provide us the full error message? It should tell you approximately where the syntax error is in your SQL statement.

  41. Any idea what might of happen here  please and thank you

    QUERY 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 ” at line 1
    Query was UPDATE users SET merits=merits+1, mgang=0 WHERE userid=

  42. Query :

    ALTER TABLE `sample` ADD `Phone` DOUBLE(15) NOT NULL AFTER `LastName`;

    This error is Continuously poping up not able to add rows or create table:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘) NOT NULL  AFTER `LastName`’ at line 1

  43.  ALTER USER ‘root’@’localhost’ IDENTIFIED BY `root`; 

    ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘root’;

     

     

    ERROR 1064 (42000): 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 ‘`root`’ at line 1

     

    for both the above commands i am getting the same error when i try to change the password.

  44. hello, everyone. please help me to find out what are the problems with my code? I just like to insert a TIMESTAMP in my table to record the time and date everytime I inserting a new info and edit an existing info.

    why #1064 error found? please check my code below. all helps are highly appreciated. ^__^.

     

    INSERT INTO ‘kaigo’ (`id`, `timedate`, `job_name`, `work_place`, `hourly_wage`, `work_day`, `holidays`, `transpo_exp`, `transpo_info`, `time_info`, `job_desc`, `salary`, `post`)

    VALUES ( NULL, NOW(),’1′ );

    1. It’s possible that SQL could be throwing the error because some of the fields are not receiving a value. Have you been able to run this query successfully before?

  45. Hello,

    The error appears to be related to the ENUM statement. You can check the document on proper usage. If you are unfamiliar with the proper usage after reading the documentation, then you will need to speak with an experienced developer for further assistance.

    If you have any further questions or comments, please let us know.

    Regards,
    Arnel C.

  46. I have the same error 1064

    SELECT Iscritti.*, IF(SCADENZA>=curdate(),'<img src=\”images/green.png\”>’,'<img src=\”images/red.png\”>’) AS STATUS FROM Iscritti WHERE  (cognome  like ‘$word%’ OR nome  like ‘$word%’ OR Insegnante like ‘$word%’ OR CONCAT(nome,’ ‘, cognome) LIKE ‘$word%’) AND Attivo = ‘SI’ORDER BY scadenza ASC  ” ;

     

    } else {$queryc=”SELECT Iscritti.*, IF(SCADENZA>=curdate(),'<img src=\”images/green.png\”>’,'<img src=\”images/red.png\”>’) AS STATUS FROM Iscritti WHERE Attivo = ‘SI’ ORDER BY scadenza ASC

    1. Hello,

      There are several syntax errors in both of those lines, Based on the else statement it looks like you may be using PHP to try and execute an SQL query with variables instead of SQL directly. Depending on your code MySQL could be interpreting parts of a variable or the ‘ and ” as MySQL syntax when it is not intended to be. I would recommend enabling MySQL query log on your server if you have access to see exactly what the query looks like to MySQL so you can be sure that MySQL is getting a valid query. I would also recommend using PDO prepared statement for your queries as doing it that way will prevent MySQL from interpreting quotations around variables or special characters within the variables from being interpreted as MySQL syntax. More info on prepared statements can be found here

      Best Regards,
      Kyle M

  47. This is my code. I don’t understand what I am doing wrong. My declare doesn’t work either in just a straight query or in a stored procedure defintion. I have tried it with “@” and I have tried it without a “@” and I get the same message. When I try to run it without a declare statement I get an error about an undefined variable.

    CREATE TEMPORARY TABLE FirstDayOfMonths(MonthDay varchar(20),
                        Record_ID int not null auto_increment primary key);

    declare rid INTEGER;

    set rid = 0;

    insert FirstDayOfMonths(MonthDay)
    select DATE_FORMAT(closed ,’%Y-%m-01′)
    from ost_ticket ot
    where closed between DATE_FORMAT(date_add(CURDATE(), interval -5 MONTH) ,’%Y-%m-01′) AND LAST_DAY(CURDATE())
    group by DATE_FORMAT(closed ,’%Y-%m-01′);

    SELECT * FROM FirstDayOfMonths;

    while 1=1
    begin
      select FirstofMonth = MonthDay
         ,pos = Record_ID
      from FirstDayOfMonths
      where rid < Record_ID
      limit 1;

      if mysql_num_rows() = 0 leave;

    end while

    DROP TABLE FirstDayOfMonths;

     

    And this is the error that I am getting.

     

    declare rid INTEGER;
    [Err] 1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘declare rid INTEGER’ at line 1

    1. Hello!

      Thanks for posting your comment regarding the MariaDB syntax error you are receiving. I recommend you review the way you are setting your variable’s initial value. You can obtain more details and information regarding declaring variables with initial values from MariaDB’s documentation. You may also find their documentation on User-defined Variables helpful in deciphering the correct syntax to use for your desired behavior. I hope this helps!

      Sincerely,
      Carlos E

  48. Hi there, am having this error when am trying to update database records, any help would be appreciated.

    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 ”users’ set id = ‘0’, phone = ‘08023855377’, username = ‘mo’ at line 1

    Regards,

    Adeniyi

  49. 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 ”)’ at line 2

    here is my code

    <?php

    require ‘database.php’;

    // create a variable

    $name=$_POST[‘name’];

    $company=$_POST[‘company’];

    $email=$_POST[’email’];

    $telephone=$_POST[‘telephone’];

    $type=$_POST[‘type’];

    $budget=$_POST[‘budget’];

    $objective=$_POST[‘objective’];

     

    //Execute the query

     

    mysqli_query($conn,”INSERT INTO contacts(name,company,email,telephone,type,budget,objective)

    VALUES(‘$name’,’$company’,’$email’,’$telephone’,’$type’,’$budget’,$objective’)”);

    if( mysqli_affected_rows($conn)>0)

    {

    echo “<p>Data Added</p>”;

    //echo “<a href=”index.php”>Go Back</a>”;

    }

    else 

    {

    echo “Data NOT Added<br />”;

    echo mysqli_error ($conn);

    }

     

    ?>

    1. Hello Srushti,

      Note that this article space is for the SQL errors, we don’t troubleshoot your PHP code. If you look at the line with the error you’ll notice that you have a double-quote close parentheses, but you don’t have an open one anywhere – that’s the syntax error. If you don’t know how to use parentheses, then please consult the documentation or speak with an experienced database programmer.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  50. SQL query:

    UPDATE user_table SET (country = 'india', state = 'westbengal', city = 'Kolkata', pincode = '700028', fulladdress = 'fgfgfg') WHERE email = '[email protected]'

    MySQL said: 

    #1064 - Erreur de syntaxe près de '(country = 'india', state = 'westbengal', city = 'Kolkata', pincode = '700028', ' à la ligne 1 

    I get this error when I try to update my database. Please help. I am very new in php mysql.

  51. please help me on this error

    — — Dumping data for table `wp_options` — INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES (1, ‘siteurl’, ‘https://realfakedocs.com’, ‘yes’), (2, ‘home’, ‘https://realfakedocs.com’, ‘yes’), (3, ‘blogname’, ‘Real Fake Documents’, ‘yes’), (4, ‘blogdescription’, ‘Just another WordPress site’, ‘yes’), (5, ‘users_can_register’, ‘0’, ‘yes’), (6, ‘admin_email’, ‘[email protected]’, ‘yes’), (7, ‘start_of_week’, ‘1’, ‘yes’), (8, ‘use_balanceTags’, ‘0’, ‘yes’), (9, ‘use_smilies’, ‘1’, ‘yes’), (10, ‘require_name_email’, ‘1’, ‘yes’), (11, ‘comments_notify’, ‘1’, ‘yes’), (12, ‘posts_per_rss’, ’10’, ‘yes’), (13, ‘rss_use_excerpt’, ‘0’, ‘yes’), (14, ‘mailserver_url’, ‘mail.example.com’, ‘yes’), (15, ‘mailserver_login’, ‘[email protected]’, ‘yes’), (16, ‘mailserver_pass’, ‘password’, ‘yes’), (17, ‘mailserver_port’, ‘110’, ‘yes’), (18, ‘default_category’, ‘1’, ‘yes’), (19, ‘default_comment_status’, ‘open’, ‘yes’), (20, ‘default_ping_status’, ‘open'[…]

    MySQL said: Documentation

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘@gmail.com’, ‘yes’),
    (7, ‘start_of_week’, ‘1’, ‘yes’),
    (8, ‘use_balanceTags’, ‘ at line 11

    1. Hello Writu,

      Your error message is related to a syntax error in your code. You will need to review your code and look for where you have incorrectly written your MySQL query. You may need to review the MySQL documentation in order to obtain the correct syntax. You may also consider online MySQL parsers such as this one. They can help to identify the exact part of your code that is incorrect. If that doesn’t help, then you should consult with an experienced database programmer.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

    2. Hello Drake,

      We can’t help with resolving an error message without looking at the MySQL code associated with the error. You may need to consult with an experienced database programmer if you are unable to resolve the coding issue. If you want us to look at it further, please provide the MySQL query associated with the error.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  52. INSERT INTO playlists VALUES (‘$nombre’, $codigouser)

    the error is: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘)’

  53. How can I insert a string like ‘0.0.0.0’ into a mysql table?

    var = ‘0.0.0.0’

    c.execute(‘INSERT INTO table VALUES (%s)’%(var))

    gives me this error:

    ProgrammingError: 1064 (42000): 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 ‘.0.0)’ at line 1

    1. Hello Anais,

      You need to look at how you’re defining the VAR. Please review this article from the MySQL website for further information.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  54. I have trouble:

    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘COUNT(kd_brg) as jml FROM t_sskel GROUP BY kd_brg, rph_aset) as t_sskel USING (k’ at line 1

    1. We need to see your SQL statement to see the error in the syntax. Please provide your SQL statement if you would like us to assist you further.

  55. Error

    SQL query:

    sharaf_xxx– Adminer 4.2.4 MySQL dump
    SET NAMES utf8;

    When the database loads, the following error appears

    Error

    SQL query:

    USE sharaf_XXX– Adminer 4.2.4 MySQL dump

    SET NAMES utf8;

    MySQL said: Documentation

    # 1064 – 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 ‘SET NAMES utf8’ at

    Please help me

    1. You may want to read through this on proper usage of set names:

      https://php.net/manual/en/mysqlinfo.concepts.charset.php

    2. Hello,

      In order for us to help you, you would need to look at the SQL query associated with the line that you provided. You need to give us a more complete (if not all) of the SQL query associated with the error.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

    3. Hello Ronan,

      In reviewing your code, we found that white spaces, tabs or extra spaces were causing the problem. We were able to test the code with no errors after removing the spaces.

      CREATE TABLE IF NOT EXISTS tweet_data (created_at DATETIME,user_name VARCHAR(20),retweet_count INT,favourite_count INT,tweet_followers_count INT,is_retweet BOOLEAN,tweet_source VARCHAR(256),user_location VARCHAR(256),tweet_mentioned_count INT,tweet_ID VARCHAR(256) NOT NULL,tweet_text VARCHAR(140),UNIQUE (tweet_ID));

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  56. #1064 – 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 ‘databases shop’ at line 1

    how to solve this error 

  57. I m getting an error when try to add a store procedure :

     

    ERROR 1064: 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 ‘JSON), ‘$.platform’) as platform,

          JSON_EXTRACT(CAST(s.chvScanData AS JSON)’ at line 41

    1. We need to see the entire query you are running. Can you provide it so we can assist you further?

  58. I am getting an error at the time of importing database from localhost to live server for uploading wordpress website.

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to 

    your MariaDB server version for the right syntax to use near ‘@’, 1) LIMIT 1′ at line 2

    please fix this issue.

    1. Without seeing the entire SQL statement being ran, we cannot troubleshoot this issue for you. Please respond with the entire SQL statement you are running.

  59. I had this query  select * from department where deptID=303;

    The issue ended up being that  * was pulling in the following fields, 

    pid, name, deptID

    Hence  name needed to be `name` and I had to spell out the field names. 

  60. Hello,

    I try to upload a database to another hosting and I get this error:

    5 Errors found during the Analysis.

    1. Unexpected character (near “&” at position 462)
    2. Unexpected statement start (near “” at position 0)
    3. Unexpected statement start (near “” at position 3)
    4. Unexpected statement start (near “&” at position 462)
    5. Unexpected statement start (near “” at position 2155

    Query SQL:

    MySQL Message:

    #1064 – 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 ‘bzh41ay&sy?6r’ at line 1

    I’m INESPERABLE.

    Thank you

    Paul

    1. Paul, it sounds like you may have a corrupt copy of your SQL data. I would recommend trying again.

  61. $db->query(“SELECT * FROM shows WHERE `BID`=$branchname  AND `HNO`=$hallno ;”);

    from the query above i got an error:

    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘AND `HNO`=’ at line 2

    1. Ensure the “branchname ” variable is being filled with a valid value, as this is often what causes this type of error.

      Thank you,
      John-Paul

  62. I am trying to upload from Blogger to WordPress. I get this error:

    CREATE DATABASE IF NOT EXISTS DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

    MySQL said: Documentation

    #1064 – 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 ‘DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci’ at line 1>

    1. The beginning of your script says ‘CREATE DATABASE IF NOT EXISTS’ but does not name a database.

  63. Oh geez, getting this erorr message when trying to access the “photo” section in the admin area of skadate 9.  Can anybody tell me how to fix this?

    Uncaught exception with message: 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 '`skadate_tmp_photo' at line 1 code: 1064
    Trace:
    #0 /home/vol11_6/myhost.com/my_username/htdocs/home/admin/inc/fnc.config_photo.php(36): SK_MySQL::query('SELECT COUNT(*)...')
    #1 /home/vol11_6/myhost.com/my_username/htdocs/home/admin/config_photo.php(131): UnProcessedPhoto()
    #2 {main}
    
    thrown in: /home/vol11_6/myhost.com/my_username/htdocs/home/internals/API/MySQL.class.php on line 169
    1. Jeffro, you will need to review the actual query that is being attempted, and then check the scenarios above for potential solutions.

  64. SQL query:

    ALTER TABLE invoice

    ADD NEW_TAX AS INV_TAX*1.20;

    MySQL said:

    ***13:48:45ALTER TABLE invoice ADD NEW_TAX AS INV_TAX*1.20Error Code: 1064. 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 ‘AS INV_TAX*1.20’ at line 20.000 sec***

    Could you please tell me how to fix it?

    1. You will need to check the syntax of your query. The proper form for adding a column is:

      ALTER TABLE table_name
      ADD column_name datatype;

  65. “select appareils.id_appareils, appareils.prix_appareils, type_appareil.description_type_appareil, marque.nom_marque FROM (appareils INNER JOIN type_appareil ON appareils.code_type_appareil = type_appareil.id_type_appareil AND INNER JOIN marque ON appareils.code_marque=marque.id_marque)”
    error in the syntax .. please help me

  66. Error

    Static analysis:

    6 errors were found during analysis.

    1. Unexpected character. (near “[” at position 57)
    2. Unexpected character. (near “]” at position 65)
    3. Unexpected character. (near “[” at position 67)
    4. Unexpected character. (near “]” at position 75)
    5. Unexpected character. (near “[” at position 77)
    6. Unexpected character. (near “]” at position 85)

    SQL query:

    INSERT INTO `username`(`id`, `username`, `hash`) VALUES ([value-1],[value-2],[value-3])

    MySQL said:

    #1064 - 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 '[value-1],[value-2],[value-3])' at line 1        why am I getting this please help???

  67.  $query = “INSERT INTO Users (`email`, `password`) VALUES (‘”.mysqli_real_escape_string($link, $_POST[’email’]).”‘, ‘”.mysqli_real_escape_string($link, $_POST[‘password’]).”‘)”;

     

    may i know whts wrong with this query?

    it shows error

    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”email’, ‘password’) VALUES(‘*******@gmail.coms’ ,’dfgs’)’ at line 1CHIMENEAS

  68. When building a schema with the data below I get an error message – The description was initially blank – I filled it with Null and what is there now. 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 ‘Resource (`ar_id` int, `activity_id` int, `resource_id` int, `description` v’ at line 1

    CREATE TABLE Activity Resource
       (`ar_id` int, `activity_id` int, `resource_id` int, `description` varchar(4), `plan_quantity` int)
    ;
    
    INSERT INTO Activity Resource
      (`ar_id`, `activity_id`, `resource_id`, `description`, `plan_quantity`)
    VALUES
        (9, 8, 3, 'description', 40),
        (10, 9, 3, 'description', 40),
        (8, 7, 4, 'description', 40),
        (11, 9, 4, 'description', 40),
        (25, 28, 10, 'description', 86),
        (26, 14, 12, 'description', 5),
        (27, 17, 12, 'description', 5),
        (28, 18, 12, 'description', 15),
        (29, 15, 12, 'description', 5),
        (30, 16, 12, 'description', 20)
    ;
    1. JD, if you are attempting to create a MySQL table that has spaces in its name, you will need to place it in backtick marks. Like `Activity Resource`

  69. Thank your for sharing. Best explanation for MySQL. I got an error for eaysocial extension as:

     

    1064

    YOU HAVE AN ERROR ?N YOUR SQL SYNTAX; CHECK THE MANUAL THAT CORRESPONDS TO YOUR MYSQL SERVER VERS?ON FOR THE R?GHT SYNTAX TO USE NEAR ‘OR `A`.`?D` NOT IN (SELECT `CATEGORY_?D` FROM `BLUE_SOC?AL_CLUSTERS_CATEGOR?ES_A’ AT L?NE 1 SQL=SELECT DISTINCT `A`.* FROM `BLUE_SOC?AL_CLUSTERS_CATEGOR?ES` AS `A` LEFT JOIN `BLUE_SOC?AL_CLUSTERS_CATEGOR?ES_ACCESS` AS `B` ON `A`.`?D` = `B`.`CATEGORY_?D` WHERE `A`.`TYPE` = ‘EVENT’ AND `A`.`STATE` = ‘1’ AND (`B`.`PROF?LE_?D` = OR `A`.`?D` NOT IN (SELECT `CATEGORY_?D` FROM `BLUE_SOC?AL_CLUSTERS_CATEGOR?ES_ACCESS`)) ORDER BY `A`.`ORDER?NG`

    1. Hello Proweblabs,

      We looked at your query and the error appears in this section of the code:

      (`B`.`PROF?LE_?D` =

      After the equal sign, there is no value set. Speake with a developer/programmer of the extension.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  70.  I got error – 1064 Check sql syntax near %f trying the code below. I used the db world provided with MYsql Workbench. In Connector/Python, I was trying  to create a cursor that enables execution of prepared statements. 

    Thanks in advance, 

    cnx = mysql.connector.connect(**config)

    cursor = cnx.cursor(prepared=True) 

     

    query = “””

    SELECT Name, Continent, Region, Population

    FROM country AS s

    WHERE s.Continent = %s  AND s.LifeExpectancy > %f”””

    cursor.execute(query, (‘Europe’, 50, ))

     cursor.execute(query, (Africa, 40))

    # print (“Countries in :”, Continent)

     

    for row in cursor:

    print(“* {Name}:  {Continent}: {Region}: {Population}”.format(**row))

     

    1. Yobel, it sounds like the ‘variable’ %f is not being populated properly. What value is this variable supposed to contain?

  71. I have #1064 error in this line please help

     mysql_query(“update student set Name=’$_POST[t3]’,Address=’$_POST[ta]’,Class=’$_POST[t5]’, Div=’$_POST[t6]’,Gender=’$_POST[t7]’,Email=’$_POST[t8]’,Phone=’$_POST[t9]’,Guardian=’$_POST[t10]’,’Guardian Phone’=’$_POST[t11]’ where ‘Reg no’=’$_POST[t2]'”);

    1. What is the full 1064 error you are getting? For example, it typically will state which line the error is occurring on.

      Thank you,
      John-Paul

    2. Error: 1064 – 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 ‘7,12,30,14,10,6,4,11,13,15,) AND s.login_type NOT IN (1)’ at line 2

      I also don’t know where to place the correct fix in my IPBoard to solve this issue

      please help!

    3. Kus, it looks like your code is trying to find something in ‘1’, but is unable to do so. This may be due to a variable being improperly set, but we really recommend reviewing this with an experienced web developer.

  72. What do I do?

    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 ‘) LIMIT 5’ at line 1 *** SQL *** SELECT `name`, series_id FROM manga_series where total_chapters > 0 AND is_online = 1 AND series_id>4483 AND series_id NOT IN () LIMIT 5

    1. The error is in the ‘series_id NOT IN () ‘ section. There needs to be at least one item in the list, for NOT IN otherwise that part of the statement is not needed.

  73. PHP Fatal error:  Uncaught exception ‘ErrorException’ with message ‘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

    ‘ASC DESC LIMIT 0,15’ at line 1

    Error No: 1064

    SELECT o.order_id, o.date_added, od.order_download_id, od.name, od.filename, od.remaining FROM ocfx_order_download od LEFT JOIN `ocfx_order` o ON (od.order_id = o.order_id) WHERE o.customer_id = ‘4’ AND o.order_status_id > ‘0’ AND o.order_status_id = ‘5’ AND od.remaining > 0 ORDER BY ASC DESC LIMIT 0,15′ in /home/cooki822/public_html/vqmod/vqcache/vq2-system_database_mysqli.php:41

    This is the error message (this happens when someone buys a downloadable

    product and tries to find it in his account (in downloads)(he will see a blank screen).

    Do you need any more info to help you identify the problem and help me?

    1. George, you will want to work with an experienced web developer, if you don’t have one already, to assist you in resolving this issue.

  74. how to fix this error

    #1064 – 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 ‘Osclass 3.7.1 2016-12-27 ———————— – Fixed URL params error – Bl’ at line 1

    Osclass 3.7.1 2016-12-27

    ————————

    – Fixed URL params error

    – Blocked upgrade on demo sites

    – Fixed some minor details

    Osclass 3.7.0 2016-12-12

    ————————

    – Multisite fixes and improvements

  75. 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 ” at line 1

     

    please help me

    1. That’s a tough one, especially without having the query that is being executed. Try going through all the scenarios above and see if any of those fit your situation.

  76. Please I have this error:

    SQL query:

    phpMyAdmin SQL Dump
    -- version 4.1.14
    -- https://www.phpmyadmin.net
    --
    -- Host: 127.0.0.1
    -- Generation Time: Jan 18, 2017 at 09:46 AM
    -- Server version: 5.6.17
    -- PHP Version: 5.5.12

    MySQL said:

    #1064 - 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 'phpMyAdmin SQL Dump
    -- version 4.1.14
    -- https://www.phpmyadmin.net
    --
    -- Host: 1' at line 1

    please help me..I am new to this kind of  problem.

    1. Hello Aksa,

      Sorry for the problem with your SQL syntax. In order to help you, we would need to see the MySQL code where the error is happening. Please provide the code and we can investigate it for you.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  77. DELIMITER $$ 

    CREATE TRIGGER `ev_dw`.`THEME_CHANGE` BEFORE UPDATE ON `ev_dw`.<`lookup_ev_theme`>

        FOR EACH ROW BEGIN

    UPDATE TABLE `ctrl_ev_app`

    SET THEME=app_theme

    WHERE NEW.id=ctrl_ev_app.maid

        END$$

     

    DELIMITER ;

    getting error in line 1

    Error Code: 1064

    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 ‘<`lookup_ev_theme`>

        FOR EACH ROW BEGIN

    UPDATE TABLE `ctrl_ev_app`

    SET THEME=’ at line 1

    1. This looks to be caused by the syntax on the following line:

      `ev_dw`.&lt`lookup_ev_theme`&gt

      I recommend reviewing the syntax there. Here is a helpful link to the documentation for the CREATE TRIGGER Syntax.

      Thank you,
      John-Paul

  78. We’re migrating our website from another hosting provider. And every time I try to upload the bzip file, this is the error I get. I am not very knowledgeable with php and SQL, so I have no idea what it means, where to find the problem and how to fix it.

    There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:
    —-BEGIN CUT—-
    eNolzT0KAjEUBOD+nWIOEEISs4rpwhJW4eXHZLWwE7Gw2U7Qk3k9o8J08zETas3VYdQYDTgkB62h
    DTbDltrcmzdRfLUDOwxyLVeWjq0iNwE/hTQLnEJH8XJFzOc9s+9MUYnewUoldY+lsitfJ3L7rxgF
    vi+PJ7FPk8Ntod/BBxlSIYo=
    —-END CUT—-
    —-BEGIN RAW—-

    ERROR: C1 C2 LEN: 11 12 759
    STR: ?
    
    MySQL: 5.6.34
    USR OS, AGENT, VER: Mac MOZILLA 5.0
    PMA: 4.0.10.14
    PHP VER,OS: 5.6.20 Linux
    LANG: en
    SQL: 

    —-END RAW—-

    SQL query:

    MySQL said:

    #1064 - 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 'BZh41AY&SY??' at line 1

    1. Hello Melissa,

      Sorry for the problem with your MySQL error. The error you’re seeing appears to be trying to process that encoded file as a MySQL query. The error you’re seeing is showing data that is NOT SQL code. This is causing the error to appear. If you were working with a compressed file, make sure you expand (uncompress) the file before processing it as a MySQL file. Your expanded file should be a file typically ending in the .SQL extension.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  79. Hello, 

    Below is my stored function code and I’m getting this error “Error Code:1064. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘=rate*amount; return(interestResult); END’ at line 5. 

     

    DELIMITER $$

    CREATE FUNCTION interest_amount(rate double, amount double)

    RETURNS DOUBLE

    BEGIN

    DECLARE result DOUBLE;

    result=rate*amount; #getting error on this line,red line under the word “result”

    RETURN (result);

    END$$

    DELIMITER ;

    1. Hello Kanvi,

      The problem you are having is related to the syntax of your equation. You would not be using that syntax for the equation in MySQL. Here’s an example of adding an equation in MySQL.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  80. my code: 

    CREATE TABLE ‘test’.’sensor’ (

     

    ‘id’ INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

    ‘time’ TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,

    ‘value’ VARCHAR( 10 ) NOT NULL)

    I’m getting error in mysql as:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”test’.’sensor’ (

    ‘id’ INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ‘time’ TIMES’ at line 1

    1. The error seems to be due to the single quote usage. You may want to try either removing them altogether or using backticks instead.

  81. Hi, I have got this 1064 Error continuously when trying to browse rows data available in my table :

    #1064 – 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 ’50.’ at line 2

    SELECT * FROM `exorti_store`  LIMIT 0 , 50.

    note: table is showing data correctly when passing other queries.

    so please help me how to fix this.

  82. Hello Freddy,

    Unfortunately it is typically the solution to replace TYPE with ENGINE when you encounter that specific error.

    I’ve searched online a bit more for this error and also see this noted as a possible solution:

    ENGINE=MyISAM DEFAULT CHARSET=utf8;

    Another thing you might want to try is leaving out the TYPE or ENGINE statements altogether and let the MySQL server try to determine what should be used.

    Also, taking a look at some of the .sql files you have on the server, it appears some of them have entries like:

    ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;

    If this is the case of the .sql file you’re trying to import, you’ll need to make sure to actually enter in the ENGINE_TYPE instead of just using that placeholder text.

    If you are still having any issues, if you can provide us with the location of the SQL script you are trying to restore we can take a look for you.

    – Jacob

  83. @gaisie,

    I tested JeffMa’s comment, and it appears to fix the problem.

    1. I ran your query and was able to replicate the same exact error.
    2. I fixed the query by putting “Equipment” within quotes after COMMENT= at the end.

    Here’s a working query that I’ve run successfully:

    CREATE TABLE equipment
    (
    id int(11) NOT NULL auto_increment,
    parent_id int(11) NOT NULL default '0',
    description varchar(20) NOT NULL default '',
    PRIMARY KEY (id)
    ) ENGINE=MyISAM COMMENT="Equipment" AUTO_INCREMENT=201
  84. It appears that you changed COMMENT=’Equipment’ into COMMENT= Equipment by accident on this second comment which would also cause an error.

  85. CREATE TABLE `equipment` (
      `id` int(11) NOT NULL auto_increment,
      `parent_id` int(11) NOT NULL default ‘0’,
      `description` varchar(20) NOT NULL default ”,
      PRIMARY KEY `id` (`id`)
    ) TYPE=MyISAM COMMENT=’Equipment’ AUTO_INCREMENT=201

     

    Err] 1064 – 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 ‘TYPE=MyISAM COMMENT=’Equipment’ AUTO_INCREMENT=201′ at line 6

    1. Hello gaisie,

      Your error may be caused by defining TYPE=MyISAM. Depending on your MySQL version, you may need to change this to ENGINE=MyISAM

  86. Hello Momodu Lucky,

    It does appear that you do have invalid syntax there. I’m unable to see the full code that you have written on and around this line, but my best guess is that you probably missed a closing quote somewhere as the syntax that your error is referring to is far from valid.

Was this article helpful? Join the conversation!