Zen Cart Logo
Forums / General Questions / 1064 Error in displaying MYSQL data after creating custom table

1064 Error in displaying MYSQL data after creating custom table

Locked

Views: 1,723

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
5 Jan 2008, 9:40 PM
#1
qwerpoiu338 avatar

qwerpoiu338

New Zenner

Join Date:
Dec 2007
Location:
Ontario, Canada
Posts:
27
Plugin Contributions:
0

1064 Error in displaying MYSQL data after creating custom table

Greetings. Tried to display a few fields in blank sidebox. Added new table in database and defined it in database_tables.php.
It returned with the following 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 '' . TABLE_NEW . ' ORDER by field1' at line 2
in:
[SELECT field1, field2' . TABLE_NEW . ' ORDER by field1]

Currently running with PHP 5.2.5; MYSQL 4.1.22;

Does this mean I need to upgrade MYSQL?

15 Jan 2008, 12:03 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: 1064 Error in displaying MYSQL data after creating custom table

No, it's not a MySQL versioning issue. It's about declarations and syntax.

Three issues to be dealt with:

  1. The table name hasn't been properly included in a "define" statement which is why it isn't getting resolved into a proper table name. You would normally include a statement in an extra_datafiles/your_datafile_name.php of the form define('TABLE_NEW', 'newtablename'); so that Zen Cart knows to which table TABLE_NEW refers
  2. You would need a space at the end of the string immediately before the constant is inserted to avoiud them running together when the constant is resolved
  3. You also need a "from" before the table name to indicate that you have finished your field list and are moving onto your tables

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

15 Jan 2008, 3:44 AM
#3
qwerpoiu338 avatar

qwerpoiu338

New Zenner

Join Date:
Dec 2007
Location:
Ontario, Canada
Posts:
27
Plugin Contributions:
0

Re: 1064 Error in displaying MYSQL data after creating custom table

Thank you. Will give it a try.