If this is your first visit, check our documentation. To post, register or login.
Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Sql error when email button selected in Coupons

Sql error when email button selected in Coupons

Locked

Started by ryk on 12 Sep 2006, 9:30 AM · Views: 2,316

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
12 Sep 2006, 9:30 AM
#1
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Sql error when email button selected in Coupons

This error message appears when I select the email button in Coupon Admin for any coupon that's been created.

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 zen_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.

As there's no real hint (to me!) of where to start looking, I could do with some direction please.

I have tried re-loading the coupon_admin.php.

Site is 1.3.0.2

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

22 Sep 2006, 4:17 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Sql error when email button selected in Coupons

Reload the /includes/functions/audience.php see if that helps ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Sep 2006, 4:17 AM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Sql error when email button selected in Coupons

NOTE: upgrading to v1.3.5 is of course suggested strongly ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Sep 2006, 8:46 AM
#4
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Sql error when email button selected in Coupons

Ajeh:

NOTE: upgrading to v1.3.5 is of course suggested strongly ...

As it will be, but I can't do everyone at once!! :D

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

6 Oct 2006, 10:28 AM
#5
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Sql error when email button selected in Coupons

Same issue here it seems:> 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 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.

Trying to e-mail form customers.php . I have this problem on 1.3.5 (upgraded formolder version) and 1.3.0.1 (but that one is in the middle of an upgrade, and uses a 1.3.5 database so that could be the problem there).

Both on:

Server OS: Linux 2.6.17-1.2142_FC4 Database: MySQL 4.1.12-standard

PHP versie: 4.4.2 (Zend versie: 1.3.0)
HTTP Server: Apache/1.3.34 (Unix) mod_ssl/2.8.25 OpenSSL/0.9.7f PHP/4.4.2 mod_perl/1.29 FrontPage/5.0.2.2510

6 Oct 2006, 10:31 AM
#6
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Sql error when email button selected in Coupons

Hmmmm... a clean 1.3.5 install on the same server does not have this problem :-o

6 Oct 2006, 10:34 AM
#7
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Sql error when email button selected in Coupons

Weird: $SESSION ?

Shouldn't that be $_SESSION ? Or is that coming from elsewhere? (I see this in the error message: "where admin_id = $SESSION:admin_id")

6 Oct 2006, 10:37 AM
#8
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Sql error when email button selected in Coupons

The sql upgrade from 1301 to 1302 shows:> # add ability to send newsletters to self

INSERT INTO query_builder ( query_category , query_name , query_description , query_string ) VALUES ('email,newsletters', 'Administrator', 'Just the email account of the current administrator', 'select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN where admin_id = $SESSION:admin_id'); Is that correct?

6 Oct 2006, 3:46 PM
#9
drbyte avatar

drbyte

Sensei

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

Re: Sql error when email button selected in Coupons

your includes/functions/audience.php is not up-to-date.

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

6 Oct 2006, 4:29 PM
#10
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Sql error when email button selected in Coupons

You are are right, thanks DrByte! :thumbsup:

I knew I skipped some files, I wonder how many more I left out somehow :blush:

    } elseif ( substr( $val, 0, 9) == '$SESSION:' ) {
      //return the value of the SESSION var indicated
      $param = str_replace('$SESSION:', '', $val);
      $val = $_SESSION[$param];

And it also clarifies the mysterious $SESSION "var" :-)