MySQL Error 1064: 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:

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;

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.

(For developers or sysadmins experienced with the command line, get High Availability and Root Access for your application, service, and websites with Cloud VPS Hosting).

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

  • 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

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

  • 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.

    • Hello sina.sorory00@gmail.com – 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.

  • 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

     

    • 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.

  • 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.  

    • 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.

  • 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

     

  • 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;

     

    • 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.

  • 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

    • 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.

    • 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.

  • 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: 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 '<?php
    $c_album="CREATE TABLE IF NOT EXISTS album (
      aid int(11) NOT NULL auto' at line 1h

    thank youu

  • 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

    • 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.

  • 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

    • 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.

  • 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

    • 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.

  • CREATE table users

    (

        user_id INT UNSIGNED NOT NULL

     AUTO_INCREMENT,

     NAME VARCHAR(128),

        email VARCHAR(128),

     PRIMARY KEY user_id,

     INDEX ( email )

    );

     

    after executing of this code i am getting 1064 error as

    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 '
    INDEX (email)
    )' at line 7

  • 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

     

  • 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

  • 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

     

  • 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

     

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

     

     

    • 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.

  • 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.

    • 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.

  •  $id=1;

        $name=’aycha’;

        $email=’hell@hmail.com’;

    $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 

    • 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.

  • Hello,

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

  • 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: 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 'CASCADE' at line 1

    Do you have any idea why this is happening?

    Thank you!

  • 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.

    • 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.

  • 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

    • 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.

  • CREATE DATABASE mantisbt DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER ‘mantisbt_owner’@’localhost’; CREATE USER ‘mantisbt_owner’@’127.0.0.1’; CREATE USER ‘mantisbt_owner’@’::1′; SET PASSWORD FOR
        ‘mantisbt_owner’@’localhost’ = PASSWORD(‘Sicherheit’);
    SET PASSWORD FOR
        ‘mantisbt_owner’@’127.0.0.1’ = PASSWORD(‘Sicherheit’);
    SET PASSWORD FOR
        ‘mantisbt_owner’@’::1′ = PASSWORD(‘Sicherheit’);
    GRANT ALL PRIVILEGES
    ON
        ‘mantisbt’.* TO ‘mantisbt_owner’@’localhost’ WITH
    GRANT OPTION
        ;
    GRANT ALL PRIVILEGES
    ON
        ‘mantisbt’.* TO ‘mantisbt_owner’@’127.0.0.1’ WITH
    GRANT OPTION
        ;
    GRANT ALL PRIVILEGES
    ON
        ‘mantisbt’.* TO ‘mantisbt_owner’@’::1′ WITH
    GRANT OPTION
        ;

     

     

    gets me this error:

     

    SQL-Befehl:

     

     

    GRANT ALL PRIVILEGES
    ON
        'mantisbt'.* TO 'mantisbt_owner'@'localhost' WITH
    GRANT OPTION
    

     

     

     

    MySQL meldet: Dokumentation

    #1064 - Fehler in der SQL-Syntax. Bitte die korrekte Syntax im Handbuch nachschlagen bei ''mantisbt'.* TO 'mantisbt_owner'@'localhost' WITH
    GRANT OPTION' in Zeile 3

    • 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”.

  • 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

    • 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.

  • 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

    • 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.

  • 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: 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 'phpMyAdmin SQL Dump

     

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

     

    • 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!

  • 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               |
     ‘—————————————————————————-+——————————————————————————-+——————-‘

    • 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

  • (“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.

    • 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.

  • 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!

  • 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)
    );

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

  • 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=

  • 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

  •  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.

  • 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′ );

    • 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?

  • Hello Sir,

     

    i a getting this type of error creating each and every table how to slove this..

    #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)NOT NULL) ENGINE=innoDB at line 1

     

     

    CREATE TABLE `alenayah`.`cakes` ( `cake_id` VARCHAR(50) NOT NULL ,`cake_name` VARCHAR(50) NOT NULL , `description` VARCHAR(50) NOT NULL ,`cake_price` VARCHAR(50) NOT NULL , `cake_image` TEXT NOT NULL , `category`VARCHAR(155) NOT NULL , `status` ENUM(1) NOT NULL ) ENGINE = InnoDB;

    • Hello,

      The error appears to be related to the ENUM statement. You can check the document on proper usage here. 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.

  • 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

    • 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

  • 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

    • 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

  • 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

  • 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);

    }

     

    ?>

    • 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.

  • 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’, ‘http://realfakedocs.com’, ‘yes’), (2, ‘home’, ‘http://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’, ‘drakexxxwizard@gmail.com’, ‘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’, ‘login@example.com’, ‘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

    • 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.

    • 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.

  • SQL query:

    UPDATE user_table SET (country = 'india', state = 'westbengal', city = 'Kolkata', pincode = '700028', fulladdress = 'fgfgfg') WHERE email = 'wri@gmail.com'

     

    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.

  • 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 ‘)’

  • 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

    • 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.

  • 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

    • 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.

  • Error

    SQL query:

    USE 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

    • 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.

    • 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.

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

  • 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

  • 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 .

     

    • 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.

  • 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. 

  • 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

  • $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

    • 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

  • I am trying to upload from Blogger to Word Press.  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

  • 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
    • Jeffro, you will need to review the actual query that is being attempted, and then check the scenarios above for potential solutions.

  • 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?

     

    • 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;

  • “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

  • 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???

  •  $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

  • 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)
    ;
    • 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`

  • 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`

    • 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.

  •  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))

     

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

  • 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]'”);

    • 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

    • 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!

    • 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.

  • 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

    • 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.

  • 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?

    • 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.

  • 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

     

  • 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

    • 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.

  • Please I have this error:

    SQL query:

     

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

     

     

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

    • 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.

  • 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

    • 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

  • 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

    • 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.

  • 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 ;

    • 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.

  • 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

  • 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.

     

     

Leave a Reply