Zen Cart Logo
Forums / Basic Configuration / 1064 You have an error in your SQL syntax

1064 You have an error in your SQL syntax

Views: 2,755

Results 1 to 7 of 7
9 Jun 2012, 12:09 PM
#1
uniquely avatar

uniquely

New Zenner

Join Date:
Jun 2012
Posts:
6
Plugin Contributions:
0

1064 You have an error in your SQL syntax

Gentlemen,

the following appears while trying to restrict the coupon within the admin panel:

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 '-0, MAX_DISPLAY_RESTRICT_ENTRIES' at line 1
in:
[select * from data_coupon_restrict where coupon_id = '1' and category_id != '0' limit -0, MAX_DISPLAY_RESTRICT_ENTRIES]

Last steps i been doing before having this issue:
Moving entire zen cart into another server, including mySQL

I assume, while reading the output, there is a new syntax necessary as of another mySQL version?

All other functions of the website are 100% working.

Thanks for your assistance

9 Jun 2012, 12:26 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: 1064 You have an error in your SQL syntax

uniquely:

for the right syntax to use near '-0, MAX_DISPLAY_RESTRICT_ENTRIES' at line 1

The syntax error is the "limit -0".

uniquely:

I assume, while reading the output, there is a new syntax necessary as of another mySQL version?

TTBOMK a negative limit is 'illegal' in all MySQL versions. I'd be more interested in how a negative zero could be derived. It's bad code somewhere, and quite probably not the direct result of your move. Perhaps one of your DB tables didn't get transferred correctly?

Cheers
Rod

9 Jun 2012, 1:58 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 1064 You have an error in your SQL syntax

Go to your Tools ... Developers Tool Kit ... and in the bottom input box enter:
MAX_DISPLAY_RESTRICT_ENTRIES

Select Admin and click SEARCH ...

Do you have a define for this constant? What is it set to?

12 Jun 2012, 8:23 AM
#4
uniquely avatar

uniquely

New Zenner

Join Date:
Jun 2012
Posts:
6
Plugin Contributions:
0

Re: 1064 You have an error in your SQL syntax

Hey,

thanks for your reply! Following echo after searching for MAX_DISPLAY_RESTRICT_ENTRIES:

In the coupon_restrict.php

Line #8 : //define('MAX_DISPLAY_RESTRICT_ENTRIES', 10);

Line #172 : $cr_split = new splitPageResults($_GET['cpage'], MAX_DISPLAY_RESTRICT_ENTRIES, $cr_query_raw, $cr_query_numrows);

Line #216 : <td class="smallText" valign="top"><?php echo $cr_split->display_count($cr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, $_GET['cpage'], TEXT_DISPLAY_NUMBER_OF_CATEGORIES); ?></td>

Line #217 : <td class="smallText" align="right"><?php echo $cr_split->display_links($cr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, MAX_DISPLAY_PAGE_LINKS, $_GET['cpage'],zen_get_all_get_params(array('cpage','action', 'x', 'y')),'cpage'); ?></td>

Line #266 : $pr_split = new splitPageResults($_GET['ppage'], MAX_DISPLAY_RESTRICT_ENTRIES, $pr_query_raw, $pr_query_numrows);

Line #306 : <td class="smallText" valign="top"><?php echo $pr_split->display_count($pr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, $_GET['ppage'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

Line #307 : <td class="smallText" align="right"><?php echo $pr_split->display_links($pr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, MAX_DISPLAY_PAGE_LINKS, $_GET['ppage'],zen_get_all_get_params(array('ppage','action', 'x', 'y')),'ppage'); ?></td> 

as well too times:

Line #27 : define('MAX_DISPLAY_RESTRICT_ENTRIES', 20); 
Line #28 : define('MAX_DISPLAY_RESTRICT_ENTRIES', 20); 

May possible to just change the sql value to "0" instead of "-0" or will it automatically rewrite it again?

12 Jun 2012, 1:24 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 1064 You have an error in your SQL syntax

This should be in the file:
/your_secret_admin/includes/languages/english/coupon_restrict.php

Line #27 : define('MAX_DISPLAY_RESTRICT_ENTRIES', 20); 
12 Jun 2012, 3:04 PM
#6
uniquely avatar

uniquely

New Zenner

Join Date:
Jun 2012
Posts:
6
Plugin Contributions:
0

Re: 1064 You have an error in your SQL syntax

ok ok sorry to bother wasting your time...

i just included another language to my zen cart and i should simply compare the files!

missed the line in the dutch coupon_restrict!

Works fine now thank you so much Ajeh!

12 Jun 2012, 3:16 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 1064 You have an error in your SQL syntax

You are most welcome ... thanks for the update that this is now working for you ... :smile: