Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

syntax error in administration query


clarkster

Recommended Posts

Posted

I've trying to move to a new server - php 5.0 and have several issues.

 

Here is issue 1:

 

When I try to do queries from the administration page I get syntax erros.

 

Here is a sample:

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

 

I've highlighted what I think is the problem.

OSC seems to be trying to escape the dash.

 

What can I do to solve this error?

 

Thank you!

Posted

Seems to be trying to escape the single quote.

 

Can you post the actual code?

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

Posted

Yes, here is the code:

 

$orders_query_raw = "select o.orders_id, o.customers_name, o.customers_email_address, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' " . (!is_null($search_query)?$search_query:''). "order by o.orders_id DESC";

 

 

I'm just looking at that and it is seeming to my non programming brain that the problem is (int) and the single quote.

Posted
I'm just looking at that and it is seeming to my non programming brain that the problem is (int) and the single quote.

Since you are using PHP5 you probably added some changes to your shop to get it running. This smells like a Magic Quotes issue that might have been solved by the 2006 update in admin/includes/functions/compatibility.php (not sure at all but the adding slashes to the quotes seems like it).

Perhaps you should try to update your shop to RC2a.

Archived

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

×
×
  • Create New...