Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL errors in admin/orders


intriguing

Recommended Posts

Hi all:

 

This is probably a long shot. I have a new OSCommerce store that I'm testing, overall it seems to run well. But, when I go into the admin/customers/orders I get the SQL error below. A similar error is generated for All Orders, Pending, Processing and Delivered.

 

Has anyone seen this before or can offer pointers ?

 

I'm running on Mac OS X Server 10.4, mySQL, lastest release of OSCommerce.

 

Thanks for the help,

 

Donald

 

 

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

 

select o.orders_id, o.customers_name, 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 s.orders_status_id = '3' and ot.class = 'ot_total' order by o.orders_id DESC limit -20, 20

Link to comment
Share on other sites

I done some more searching in the forums and found this solution, fixed the pproblem just nicely.

 

In admin/includes/classes/split_page_results.php, change below:

 

 

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

 

// +patch

if ($offset < 0) { $offset = 0; }

// -patch

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

}

 

 

 

 

Hi all:

 

This is probably a long shot. I have a new OSCommerce store that I'm testing, overall it seems to run well. But, when I go into the admin/customers/orders I get the SQL error below. A similar error is generated for All Orders, Pending, Processing and Delivered.

 

Has anyone seen this before or can offer pointers ?

 

I'm running on Mac OS X Server 10.4, mySQL, lastest release of OSCommerce.

 

Thanks for the help,

 

Donald

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

 

select o.orders_id, o.customers_name, 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 s.orders_status_id = '3' and ot.class = 'ot_total' order by o.orders_id DESC limit -20, 20

Link to comment
Share on other sites

Hey! Did you change the first part TO the second part? I'm not sure what you mean "change below." Can you tell me what it looked like and what it becomes? Thanks! I'm having the same problem.

 

I done some more searching in the forums and found this solution, fixed the pproblem just nicely.

 

In admin/includes/classes/split_page_results.php, change below:

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

 

        // +patch

      if ($offset < 0) { $offset = 0; }

        // -patch

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

    }

Link to comment
Share on other sites

The change was:

 

before

 

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

 

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

}

 

after

 

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

 

// +patch

if ($offset < 0) { $offset = 0; }

// -patch

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

}

 

Hope that helps,

 

Donald

 

 

I done some more searching in the forums and found this solution, fixed the pproblem just nicely.

 

In admin/includes/classes/split_page_results.php, change below:

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

 

        // +patch

      if ($offset < 0) { $offset = 0; }

        // -patch

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

    }

Link to comment
Share on other sites

  • 2 weeks later...

I have a similar problem with my order-page. The limit is ok (LIMIT 0,20), but there is no "order by"-argument:

 

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

 

select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from fsrshop_orders o left join fsrshop_orders_total ot on (o.orders_id = ot.orders_id), fsrshop_orders_status s where o.orders_status = s.orders_status_id and s.language_id = '2' and ot.class = 'ot_total' order by limit 0, 20

 

[TEP STOP]

 

It seems that in orders.php the variable $order is empty.

I also miss the files "ic_up.gif" and "ic_down.gif".

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...