Forums / General Questions / SQL error in "Send Email"

SQL error in "Send Email"

Locked

Started by flightoffancy on 4 Sep 2008, 6:32 PM · Views: 1,544

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
4 Sep 2008, 6:32 PM
#1
flightoffancy avatar

flightoffancy

New Zenner

Join Date:
Dec 2005
Posts:
56
Plugin Contributions:
0

SQL error in "Send Email"

When trying to utilize the Send Email function from Tools I'm getting the following SQL 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 '1''' at line 1
in:
[select customers_firstname, customers_lastname, customers_email_address from customers where customers_newsletter = ''1'' ]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Any ideas on what I need to do to fix it?

5 Sep 2008, 4:49 AM
#2
canopy avatar

canopy

Totally Zenned

Join Date:
Oct 2006
Posts:
625
Plugin Contributions:
0

Re: SQL error in "Send Email"

Try going through the steps in troubleshooting your email problems as documented here.

Goh Koon Hoek, author of "e-Start Your Web Store with Zen Cart".
Printed book: www.lulu.com/content/10576284
Electronic book and Errata: www.cucumbermedia.com/store

5 Sep 2008, 7:20 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: SQL error in "Send Email"

This one's not an email problem.

You'll need to manually edit the query record in the query_builder table and change ''1'' (quote quote one quote quote) to just '1' or even just 1

The repeated quotation marks are likely a result of a PHP setting for magic_quotes_sybase on your server ... which can occasionally cause the extra quotes for supposed security.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

5 Sep 2008, 12:17 PM
#4
flightoffancy avatar

flightoffancy

New Zenner

Join Date:
Dec 2005
Posts:
56
Plugin Contributions:
0

Re: SQL error in "Send Email"

DrByte:

This one's not an email problem.

You'll need to manually edit the query record in the query_builder table and change ''1'' (quote quote one quote quote) to just '1' or even just 1

The repeated quotation marks are likely a result of a PHP setting for magic_quotes_sybase on your server ... which can occasionally cause the extra quotes for supposed security.

Thank you so much! I had no idea how to manually edit that record so I just grabbed the query_builder section from the SQL file in the zc_install folder and ran that as a query on my database and it fixed the problem.

Thanks again!

5 Sep 2008, 8:47 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: SQL error in "Send Email"

I hope you included the "drop table" command so that the already-existing records were removed as part of the process ... you don't want duplicates.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2008, 2:58 AM
#6
tajul_ashyqin avatar

tajul_ashyqin

Zen Follower

Join Date:
Apr 2006
Location:
Labuan Island
Posts:
362
Plugin Contributions:
1

Re: SQL error in "Send Email"

what about this SQL syntax 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 ':admin_id' at line 1
in:
[select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from etoprace_admin where admin_id = $SESSION:admin_id ]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.need help on this....:frusty:

"Whether you think you can, or you think you can't... YOU ARE RIGHT."
GOOD LUCK !!!

12 Sep 2008, 3:50 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: SQL error in "Send Email"

That error suggests that you're using an outdated version of /includes/functions/audience.php. I believe the functionality that's missing was added in 1.3.7, maybe even 1.3.6. If you're getting that kind of message then you're running out-of-date code against newer database content.
First make sure you've upgraded to the latest version of Zen Cart. Then make sure that file is also matching the version you're running.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2008, 4:04 AM
#8
tajul_ashyqin avatar

tajul_ashyqin

Zen Follower

Join Date:
Apr 2006
Location:
Labuan Island
Posts:
362
Plugin Contributions:
1

Re: SQL error in "Send Email"

oh, yes...now i remember..i upgraded my databases from v1.3.0.1 to the latest current version but all my codes is still v1.3.0.1...is there any temporary fix for this as i am still doing the upgrading...:cry:

"Whether you think you can, or you think you can't... YOU ARE RIGHT."
GOOD LUCK !!!

12 Sep 2008, 4:14 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: SQL error in "Send Email"

As I said, do your upgrade, and ensure the file I mentioned is current.

You really should NEVER upgrade a live site directly. You should always do it on a test site first. Upgrade documentation references are described here: https://www.zen-cart.com/tutorials/index.php?article=98

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2008, 7:56 AM
#10
tajul_ashyqin avatar

tajul_ashyqin

Zen Follower

Join Date:
Apr 2006
Location:
Labuan Island
Posts:
362
Plugin Contributions:
1

Re: SQL error in "Send Email"

thank you DrByte...I'd just replaced the audience.php file with the latest version...seems to be working but only for Rich-Text Messages...when you sent the Text-Only Messages, seems the message is empty...:oops:

"Whether you think you can, or you think you can't... YOU ARE RIGHT."
GOOD LUCK !!!