Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

another error if any one could help plz


paul01609

Recommended Posts

Posted

im getting another error when i click on the specials on my site,i fixed one error by searching the net now i have another could some one please try help me out with step by step instructions if its possible to fix many thx

 

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 p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -6, 6

 

[TEP STOP]

Posted

Hmm, reminds me of a post from last night.

 

limit -6,6 means return records starting from -6th record for 6 which is not valid unless you are using prepared statements

 

From http://dev.mysql.com

 

The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be non-negative integer constants (except when using prepared statements).

 

With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):

 

The syntax is

 

SELECT

[ALL | DISTINCT | DISTINCTROW ]

[HIGH_PRIORITY]

[sTRAIGHT_JOIN]

[sql_SMALL_RESULT] [sql_BIG_RESULT] [sql_BUFFER_RESULT]

[sql_CACHE | SQL_NO_CACHE] [sql_CALC_FOUND_ROWS]

select_expr, ...

[FROM table_references

[WHERE where_condition]

[GROUP BY {col_name | expr | position}

[ASC | DESC], ... [WITH ROLLUP]]

[HAVING where_condition]

[ORDER BY {col_name | expr | position}

[ASC | DESC], ...]

[LIMIT {[offset,] row_count | row_count OFFSET offset}]

[PROCEDURE procedure_name(argument_list)]

[iNTO OUTFILE 'file_name' export_options

| INTO DUMPFILE 'file_name'

| INTO var_name [, var_name]]

[FOR UPDATE | LOCK IN SHARE MODE]]

 

 

http://dev.mysql.com/doc/refman/5.0/en/select.html

 

So what page are you getting this error on?

 

What is it trying to do?

 

Is this error visible on your site? If so are you willing to post the url?

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

Archived

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

×
×
  • Create New...