Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

1064 - You have an error in your SQL syntax


Recommended Posts

Hi. This happened to me when I deleted all the orders from admin. I also got it when I deleted all the stock manufacturers from admin. It also happened when I deleted all the specials. All I had to do to fix the orders error was to place another order. Then it wasnt emty so it displayed. I was able to grab the mysql insert command for one of the stock manufacturers and that took care of that error. However, the same trick does not seem to work for specials and I am stuck. Any ideas or help?


<error message>

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 p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from products p, specials s, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = s.products_id order by pd.products_name limit -20, 20

</error message>

Link to comment
Share on other sites

Not sure what the bug is, but here is how I got rid of the error.


The bug is in admin when I delete EVERY item in a category. Specials for example. I deleted all the specials in admin and then admin/specials.php throws the error above. The difference between manufacturers and specials is that specials MUST correspond to an actual product ID in the catalog. Problem is that I deleted all those too. So, I took the product id from the only product currently in the catalog and used this:


// Connecting, selecting database
$link = mysql_connect('databaseServer', 'username', 'password')or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('databaseName') or die('Could not select database');
// Performing SQL query
$query = "INSERT INTO specials VALUES (5,28, 129.99, now(), '', '', '', '1');";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());


I saved this as specials_query.php and pointed my browser to it.


This created a special for product id 28 and when I looked for it in admin it now showed up.

Link to comment
Share on other sites


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

  • Create New...