Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL syntax error in order_history.php


Guest

Recommended Posts

Hello all,

 

I'm getting the following error when accessing order_history.php:

 

1064 - You have an error in your SQL syntax near 'DESC, limit 0, MAX_DISPLAY_ORDER_HISTORY' at line 1

 

select o.orders_id, o.date_purchased, o.delivery_name, ot.text as order_total, s.orders_status_name from orders o left join orders_total ot on (o.orders_id = ot.orders_id) left join orders_status s on (o.orders_status = s.orders_status_id and s.language_id = '1') where o.customers_id = '483' and ot.class = 'ot_total' order by DESC, limit 0, MAX_DISPLAY_ORDER_HISTORY

 

[TEP STOP]

 

What's going on and how do I fix it? I'm not a PHP/MySQL guru so any help is appreciated.

Link to comment
Share on other sites

Looks like you don't have the definition for the MAX_DISPLAY_ORDER_HISTORY set up in your application_top.php

 

Add this to that file...

 

define('MAX_DISPLAY_ORDER_HISTORY ', '5');

 

 

And that should fix it.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Hmm..I added what you suggested to application_top and still does not work. Is there any particular spot in there it needs to be? Seems like as long as it's there, account_history.php should be able to find it.

 

I have also tried adding it to /includes/.../account_history.php to no avail.

 

I also tried hardcoding MAX_DISPLAY_ORDER_HISTORY to 10 and still get the same error (only instead of displaying the variable name it displays the hardcoded number).

 

In the admin control panel, under 'Maximum Values', it has a value of 10 associated to "Customer Order History Box". Does this value have anything to do with my problem? Where does the admin store this value? Perhaps MAX_DISPLAY_ORDER_HISTORY is an incorrect variable?

Link to comment
Share on other sites

Hello all,

 

I'm getting the following error when accessing order_history.php:

 

1064 - You have an error in your SQL syntax near 'DESC, limit 0, MAX_DISPLAY_ORDER_HISTORY' at line 1

 

select o.orders_id, o.date_purchased, o.delivery_name, ot.text as order_total, s.orders_status_name from orders o left join orders_total ot on (o.orders_id = ot.orders_id) left join orders_status s on (o.orders_status = s.orders_status_id and s.language_id = '1') where o.customers_id = '483' and ot.class = 'ot_total' order by DESC, limit 0, MAX_DISPLAY_ORDER_HISTORY

 

[TEP STOP]

 

What's going on and how do I fix it? I'm not a PHP/MySQL guru so any help is appreciated.

 

I meant to type "account_history.php" instead of "order_history.php" in the above post, just to clarify and avoid any confusion.

Link to comment
Share on other sites

I fixed it.

 

I realised that there was a space in the variable definition. I took that out and VOILA..It works now. Thanks for the help, wizard.

Link to comment
Share on other sites

:wink:

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

  • 10 months later...

I seem to be having a similar problem, except my error starts right at the beginning of the query.

 

The strange thing is that I had this working on my web server, but when I transferred it to my customer's server, this started happening. The guy is hosted at the same place as I am. Any idea why this could be happening?

 

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 'select o.orders_id, o.orders_status, o.date_purchased, o.delive

 

select count(select o.orders_id, o.orders_status, o.date_purchased, o.delivery_name, ot.text as order_total, s.orders_status_name from orders o left join orders_total ot on (o.orders_id = ot.orders_id) left join orders_status s on (o.orders_status = s.orders_status_id and s.language_id = \'1\') where o.customers_id = \'4936\' and ot.class=\'ot_total\' order by orders_id DESC) as total

 

[TEP STOP]

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...