Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL errors any help?


bayerl

Recommended Posts

i keep getting message like this in the admin section and when i try to make a new customer on the end user side.

 

 

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 '-6, 6' 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 ot.class = 'ot_total' order by o.orders_id DESC limit -6, 6

Link to comment
Share on other sites

You need to make the same fixes that are in recent versions of osC. How far out of date is your installation? In the PHP statement that builds the "LIMIT" clause, it gives $offset as the first number. Sometimes this comes out negative (e.g., -6). The fix is to change $offset to max($offset,0) in every "LIMIT" clause (two "split_page_results.php" files). Or, upgrade to 2.2 RC2a, the last of the 2.x development branch.

Link to comment
Share on other sites

thanks for the help, ive updated to 2.2 and it seems to have fixed alot of the problems

just wondering im having trouble with the admin login. im not to great with scripts , here is the error

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mysql'@'localhost' (using password: NO) in /home/china/public_html/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

 

 

i think it has to do with this section of the database file but not sure.

 

 

 

 

 

function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

global $$link;

 

if (USE_PCONNECT == 'true') {

$$link = mysql_pconnect($server, $username, $password);

} else {

$$link = mysql_connect($server, $username, $password);

}

 

if ($$link) mysql_select_db($database);

Link to comment
Share on other sites

That error typically means the username and password located in the configure.php files do not match the actual username and password for the database. Check the database username and password to ensure they match the values in the TWO configure.php files.

 

 

Chris

Link to comment
Share on other sites

thanks for that i found the details, put it in got this msg

Parse error: syntax error, unexpected T_STRING in /home/china/public_html/admin/includes/configure.php on line 41

 

define('DB_SERVER'localhost');

 

 

this is my code

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...