InMotion Hosting Support Center

In this tutorial:


When working with programs that have a database, you face the possibility of having database errors as well as regular php errors. This guide explains what the 1064 error is, some likely causes, and general troubleshooting

Causes for the 1064 error

This error message may seem cryptic at first. That is because it is a general MySQL error pointing to a syntax error of some sort in the SQL Query statement. This error can have multiple causes which are explained below

Using reserved words

Every version of MySQL has its own list of reserved words. These are words that are used for specific purposes or 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 in the database is missing. This can cause issues when this data is required for a query. 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:

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 this type error within MySQL code. This list will be updated as more specific instances are reported.

Support Center Login

Social Media Login

   
Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
You have an error in your SQL syntax
Help with a 1064 error
mysql5.6.17 comman line cannot create my passworddddd
Need help with error # 1064
Notice: Error: You have an error in your SQL syntax
what's the Database server address
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2016-11-26 2:51 am

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.

 

 

Staff
42,960 Points
2016-11-28 2:57 pm
If you wish to limit the results to 50, you do not need the 0 in front of it. Just set "LIMIT 50"
n/a Points
2016-11-26 11:39 am

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

Staff
42,960 Points
2016-11-28 3:06 pm
The error seems to be due to the single quote usage. You may want to try either removing them altogether or using backticks instead.
n/a Points
2016-11-30 12:00 pm

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 ;

Staff
37,289 Points
2016-11-30 12:31 pm
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.
n/a Points
2017-01-04 6:56 pm

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+nWIOEEISs4rpwhJW4eXHZLWwE7Gw2U7Qk3k9o8J08zETas3VYdQYDTgkB62hDTbDltrcmzdRfLUDOwxyLVeWjq0iNwE/hTQLnEJH8XJFzOc9s+9MUYnewUoldY+lsitfJ3L7rxgFvi+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: 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 'BZh41AY&SY??' at line 1

Staff
37,289 Points
2017-01-04 8:09 pm
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.
n/a Points
2017-01-12 9:44 am

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

Staff
27,915 Points
2017-01-12 1:46 pm
This looks to be caused by the syntax on the following line:
`ev_dw`.<`lookup_ev_theme`>


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

Thank you,
John-Paul
n/a Points
2017-01-18 6:37 am

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

 

 

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

Staff
37,289 Points
2017-01-19 3:00 am
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.
n/a Points
2017-01-22 4:52 am

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

Staff
42,960 Points
2017-01-23 6:16 pm
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.
n/a Points
2017-01-29 1:50 pm

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

 

Staff
42,960 Points
2017-01-30 4:08 pm
You are not using a SQL Query.
n/a Points
2017-02-03 7:44 am

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?

Staff
2,357 Points
2017-02-03 12:00 pm
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.
n/a Points
2017-02-03 11:45 pm

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

Staff
42,960 Points
2017-02-06 10:08 am
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.
n/a Points
2017-02-09 6:22 am

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

Staff
27,915 Points
2017-02-09 1:35 pm
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
2017-02-17 5:01 pm
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!
Staff
2,357 Points
2017-02-17 5:10 pm
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.
n/a Points
2017-02-19 1:32 pm

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

 

Staff
2,357 Points
2017-02-20 6:33 pm
Yobel, it sounds like the 'variable' %f is not being populated properly. What value is this variable supposed to contain?
n/a Points
2017-03-01 9:20 am

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`

Staff
37,289 Points
2017-03-01 4:12 pm
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.
n/a Points
2017-03-16 6:37 pm

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)
;
Staff
2,357 Points
2017-03-17 12:41 pm
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`
n/a Points
2017-04-05 6:50 pm

 $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

Staff
27,915 Points
2017-04-06 1:14 pm
It looks like you have some unnecessary quotation marks (") in your statement. Here is a helpful link to information on the SQL INSERT INTO Statement where they provide working examples.

Thank you,
John-Paul
n/a Points
2017-04-21 5:36 pm

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

Staff
2,357 Points
2017-04-21 6:09 pm
Burson, you need to place the values inside single quotes.

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

710 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!