Jump to content

Archived

This topic is now archived and is closed to further replies.

Simplyeasier

1064 - You have an error in your SQL syntax

Recommended Posts

http://www.w3schools.com/sql/sql_where.asp

 

Is there any reason why you have =like ?


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites
http://www.w3schools.com/sql/sql_where.asp

 

Is there any reason why you have =like ?

 

hi, i went through the link that you sent, but i can't find any solution and don't know what to do... can i trouble you to guide me with specifics? (i'm not IT trained at all...sorry...)

 

As for your question on "=like", I'm not sure..but I wonder if its related to the "zone shipping contribution"?

 

Thanks.

Share this post


Link to post
Share on other sites
http://www.w3schools.com/sql/sql_where.asp

 

Is there any reason why you have =like ?

 

 

i got the problem following :

 

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 'MAX_RANDOM_SELECT_NEW' at line 1

 

select products_id, products_image, products_tax_class_id, products_price from products where products_status = '1' order by products_date_added desc limit MAX_RANDOM_SELECT_NEW

 

[TEP STOP]

 

any idea for help me fix this trouble??? :rolleyes:

 

and on my admin i got

 

I really apreciate for your help.

 

Thanks

wibisono

Share this post


Link to post
Share on other sites
As for your question on "=like", I'm not sure..but I wonder if its related to the "zone shipping contribution"?
It should be just like (no =).

 

Jack

Share this post


Link to post
Share on other sites

Hi,

 

I had your original error but fixed it so thanks a lot for that!

 

However I'm getting 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 '-6, 6' at line 1

 

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -6, 6

 

It is on my /specials.php page. Can anyone help me fix it?

 

Thanks a lot,

Jamie

Share this post


Link to post
Share on other sites
Hi

 

First off - this fix is actually already recorded in the contributions section and many thanks to those who recorded it - but I don't think it is a contribution - rather a tip - Secondly the same problem has arisen for 4 people in a few days and I dare say it will happen to more as hosts migrate their mySQL databases to version 4.1.xx -

 

Hence I post here :D

 

If you get an error whilst creating \ modifying your database such that thro admin you delete all entries on a particular table you will likely get this 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 '-20, 20' at line 1

 

followed by something like

 

select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from manufacturers order by manufacturers_name limit -20, 20

 

or

 

select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from banners order by banners_title, banners_group limit -20, 20

 

depending on which table you have deleted all records from.

 

To fix this

 

In admin/includes/classes find split_page_results.php and - BACK IT UP then find the lines

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

change to

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

if ($offset < 0)

{

$offset = 0 ;

}

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

 

MySQL 4.1.xx handles negatives correctly (by forcing an error) in the code above unlike earlier versions of MySQL.

 

:o NOTE - I have NOT asked you to change catalog/includes/classes/split_page_results.php - If you have a problem on the catalog side you may want to try the same change in that file - I did and it went wrong so the change to my catalog/includes/classes/split_page_results.php file is a little more elaborate and I will share that here if it becomes an issue - but for now it seems people will mostly have a problem with empty files on the admin side.

 

hth

 

Charles

 

 

 

can you understand this error?

I have install osCommerce_XML_0_6

 

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/empero/public_html/IEG/shoes/admin/oscommerce_xml.php on line 68

 

Warning: array_filter() [function.array-filter]: The first argument should be an array in /home/empero/public_html/IEG/shoes/admin/oscommerce_xml.php on line 70

 

Warning: implode() [function.implode]: Invalid arguments passed in /home/empero/public_html/IEG/shoes/admin/oscommerce_xml.php on line 72

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 ')' at line 1

 

select * from products left join products_description using(products_id) left join products_to_categories using(products_id) where language_id='1' and categories_id in ()

 

[TEP STOP]

Share this post


Link to post
Share on other sites

when client gets login then

 

it shows

 

1054 - Unknown column 'member_level' in 'field list'

 

select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id, member_level from customers where customers_email_address = 'cardi@infosis.com'

 

[TEP STOP]

 

how can i remove this problem?

Share this post


Link to post
Share on other sites

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

igot this error in my admin panel when I try to approve edded article, I have AlstraSoft Article Manager Pro script.

Can you help me with this? plzz

Share this post


Link to post
Share on other sites
Hi

 

First off - this fix is actually already recorded in the contributions section and many thanks to those who recorded it - but I don't think it is a contribution - rather a tip - Secondly the same problem has arisen for 4 people in a few days and I dare say it will happen to more as hosts migrate their mySQL databases to version 4.1.xx -

 

Hence I post here :D

 

If you get an error whilst creating \ modifying your database such that thro admin you delete all entries on a particular table you will likely get this 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 '-20, 20' at line 1

 

followed by something like

 

select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from manufacturers order by manufacturers_name limit -20, 20

 

or

 

select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from banners order by banners_title, banners_group limit -20, 20

 

depending on which table you have deleted all records from.

 

To fix this

 

In admin/includes/classes find split_page_results.php and - BACK IT UP then find the lines

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

change to

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

if ($offset < 0)

{

$offset = 0 ;

}

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

 

MySQL 4.1.xx handles negatives correctly (by forcing an error) in the code above unlike earlier versions of MySQL.

 

:o NOTE - I have NOT asked you to change catalog/includes/classes/split_page_results.php - If you have a problem on the catalog side you may want to try the same change in that file - I did and it went wrong so the change to my catalog/includes/classes/split_page_results.php file is a little more elaborate and I will share that here if it becomes an issue - but for now it seems people will mostly have a problem with empty files on the admin side.

 

hth

 

Charles

 

 

Three years later... Still a GREAT tip!

Thanks a million, it solved my problem!

 

Mary

Share this post


Link to post
Share on other sites

Hi all,

 

I have a similar problem. I have tried the fix on the first page, but unfortunately that didn't help.

 

The error I'm getting is as follows:

 

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 '-12, 12' at line 1

 

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -12, 12

 

[TEP STOP]

 

 

Here is a link to the page in question if that helps: http://irrigationcentre.com.au/shop/specials.php

 

 

Coding isn't really my strong point, so any help at all would be much appreciated.

 

Thanks in advance!

Share this post


Link to post
Share on other sites

i get this in my specials page

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 '-6, 6' at line 1

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -6, 6

[TEP STOP]

Share this post


Link to post
Share on other sites
i get this in my specials page

That is because the same fix has to be applied to catalog/includes/classes/split_page_results.php.

Read the first post again.

Share this post


Link to post
Share on other sites
That is because the same fix has to be applied to catalog/includes/classes/split_page_results.php.

Read the first post again.

 

 

thanks got it....

Share this post


Link to post
Share on other sites

TOO BAD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

I how to do fix my page???? 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 'where p.products_status = '1' and pd.products_id = p.products_id and pd.language' at line 1

select count(p.products_id) as total from ((products p, products_description pd, manufacturers m ) left join specials s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '17'

[TEP STOP]

Share this post


Link to post
Share on other sites

Well can anybody help me with these errors i got under admin then under customers?

 

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 'limit 0, 20' at line 1

 

limit 0, 20

 

then I got error under catalog like 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 ' 20' at line 1

 

select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '21' order by pd.products_name limit , 20

 

I did that fix what was listed on 1st page that didnt fix it.

 

also I wanted to add in my server info for anybody so they can help me:

Server OS: Linux 2.6.24-19-server Database: MySQL 5.0.51a-3ubuntu5.1

Server Date: 08/05/2008 01:27:33 Datebase Date: 08/05/2008 01:27:33

Server Up Time: 01:27:33 up 17 days, 11:16, 0 users, load average: 0.00, 0.00, 0.00

HTTP Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g mod_perl/2.0.3 Perl/v5.8.8

PHP Version: 5.2.4-2ubuntu5.3 (Zend: 2.2.0)

Share this post


Link to post
Share on other sites

Hi

When I migrate one site which is run on old version MySQL, version 3.23, to a new MySQL vesion5.0, I got the following error. The scrip works fine the old version MySQL, but not the new one.

 

1054 - Unknown column 'a.authors_id' in 'on clause'

 

select a.articles_id from articles a, articles_to_topics a2t left join topics_description td on a2t.topics_id = td.topics_id left join authors au on a.authors_id = au.authors_id, articles_description ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '1' and td.language_id = '1' and a.articles_date_added > SUBDATE(now( ), INTERVAL '30' DAY)

 

 

I am new to this. Please help me here.

Share this post


Link to post
Share on other sites

I've searched through this forum and applied the original fix, but it didn't help my problem. I hope somebody can look at this and see where I've made a mistake! Thanks so much to everybody for being so supportive.

 

I receive this error when trying to edit a product under admin:

 

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 'on p.products_id = ptdc.products_id, products_description pd where p.products_id' at line 1

 

select pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_qty_blocks, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_free_shipping, ptdc.discount_categories_id from products p, products_to_discount_categories ptdc on p.products_id = ptdc.products_id, products_description pd where p.products_id = '145' and p.products_id = pd.products_id and pd.language_id = '1'

 

[TEP STOP]

Share this post


Link to post
Share on other sites

Hello,

 

Tried the "fix" but nothing helped.

 

Still getting 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 'now(),'O:12:"shoppingcart":5:{s:8:"contents";a:1:{i:30;a:1:{s:3:

 

INSERT INTO TABLE_IDEAL_PAYMENTS (transaction_id, entrancecode, issuer_id, order_id, payment_status, date_last_check,cart_contents) values (0, '5d51bcac5b21016d26d2ed8788f7c6d5',0151,55, ,now(),'O:12:"shoppingcart":5:{s:8:"contents";a:1:{i:30;a:1:{s:3:"qty";s:1:"1";}}s:5:"total";d:1;s:6:"weight";d:0;s:6:"cartID";N;s:12:"content_type";s:8:"physical";}')

 

[TEP STOP]

 

 

This is when the user confirmes the payment.

 

Google search brings me nowhere but on this forum :blush:

 

plz help. :huh:

Share this post


Link to post
Share on other sites

Hi all,

 

I only get this in my admin (orders) page when reviewing an invoice that has a product that has been deleted.

 

1 x Blue Widget Extreme Size1064 - 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 'and pta.products_text_attributes_id = ota.products_text_attributes_id' at line 1

 

select ota.*, pta.products_text_attributes_name from orders_text_attributes as ota, products_text_attributes as pta where ota.orders_id = 1890 and ota.products_id = and pta.products_text_attributes_id = ota.products_text_attributes_id

 

[TEP STOP]

 

I tried "Simplyeasier" fix but does not work for this.

Thanks for any ideas!


define('PROJECTS', 'Something that goes on forever!');

Share this post


Link to post
Share on other sites

Hi all,

 

I have a bit different error and I get it only when my session in Admin part ends. Here it is:

 

File: catalog/admin/admin_account.php

 

When I'm not logged in (ie. login timeout) and try to access the account modification page, I get 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 'and g.admin_groups_id=' at line 1

select a.admin_id, a.admin_firstname, a.admin_lastname, a.admin_email_address, a.admin_created, a.admin_modified, a.admin_logdate, a.admin_lognum, g.admin_groups_name from admin a, admin_groups g where a.admin_id= and g.admin_groups_id=

[TEP STOP]

Note that when i'm logged in, so after i log in again, everything works fine.

 

Any ideas ?

Share this post


Link to post
Share on other sites
Hi all,

 

I have a bit different error and I get it only when my session in Admin part ends. Here it is:

 

File: catalog/admin/admin_account.php

 

When I'm not logged in (ie. login timeout) and try to access the account modification page, I get the following error:

 

Note that when i'm logged in, so after i log in again, everything works fine.

 

Any ideas ?

 

I've just had this error on an oscMax install - the host server had Register Globals set to 'off' and I had incorrectly applied one of the osC Register Globals patches (I forgot to amend the admin sessions function). Once I applied the patch correctly it all works :rolleyes:

 

Try adding in a Register Globals fix and see what happens

 

Graeme

Share this post


Link to post
Share on other sites
Hi

 

First off - this fix is actually already recorded in the contributions section and many thanks to those who recorded it - but I don't think it is a contribution - rather a tip - Secondly the same problem has arisen for 4 people in a few days and I dare say it will happen to more as hosts migrate their mySQL databases to version 4.1.xx -

 

Hence I post here :D

 

If you get an error whilst creating \ modifying your database such that thro admin you delete all entries on a particular table you will likely get this 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 '-20, 20' at line 1

 

followed by something like

 

select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from manufacturers order by manufacturers_name limit -20, 20

 

or

 

select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from banners order by banners_title, banners_group limit -20, 20

 

depending on which table you have deleted all records from.

 

To fix this

 

In admin/includes/classes find split_page_results.php and - BACK IT UP then find the lines

 

$offset = ($max_rows_per_page * ($current_page_number - 1));
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

change to

 

$offset = ($max_rows_per_page * ($current_page_number - 1));
 if ($offset < 0)
{
$offset = 0;
}
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

 

MySQL 4.1.xx handles negatives correctly (by forcing an error) in the code above unlike earlier versions of MySQL.

 

:o NOTE - I have NOT asked you to change catalog/includes/classes/split_page_results.php - If you have a problem on the catalog side you may want to try the same change in that file - I did and it went wrong so the change to my catalog/includes/classes/split_page_results.php file is a little more elaborate and I will share that here if it becomes an issue - but for now it seems people will mostly have a problem with empty files on the admin side.

 

Change (catalog/includes/classes/split_page_results.php around line 67) from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to:

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

 

Both on the catalog side and the admin side changing $offset to max($offset, 0) is the "official" fix.

 

hth

 

Charles

 

 

Hi,

 

I used your fix which worked great for one of the two errors i have, can you tell me how to fix this error, this error list below only shows up when i want to edit a product from the admin side ONLY.. No error on the catalog side???????????

 

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 'from products p, products_description pd where p.products_id = '185' and p.produ' at line 1

 

select p.products_name, p.products_description, p.products_url, p.products_keywords, p.products_metadescription, p.products_pagetitle, p.products_id, p.products_quantity, p.products_model, p.products_image, p.product_image_2, p.product_image_3, p.product_image_4, p.product_image_5, p.product_image_6, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, from products p, products_description pd where p.products_id = '185' and p.products_id = pd.products_id and pd.language_id = '1'

 

 

Thank you

Share this post


Link to post
Share on other sites

Endless thanks for this quick and effective fix - the wonders of the excellent assistance and support found in these forums always amazes me anew - I am eternally grateful to all those who take of their own time to help me find solutions to problems over the years - - Bess You All

Share this post


Link to post
Share on other sites

×