Jump to content

PS_category error "nleft > AND nright < ". How to restore db?


maria zagula

Recommended Posts


Hi !

 

I tried to copy data from one base to another and I have "by hand" modifed ps_category (ps_category_lang, ps_category_shop etc). Right now when I open home page I get such an error




[PrestaShopDatabaseException]

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 'AND nright <' at line 1

SELECT id_category FROM ps_category WHERE nleft > AND nright <
at line 791 in file classes/db/Db.php

786. if ($webservice_call && $errno) {
787. $dbg = debug_backtrace();
788. WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
789. } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {
790. if ($sql) {
791. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
792. }
793.
794. throw new PrestaShopDatabaseException($this->getMsgError());
795. }
796. }


 

Right now I know that it was a huge mistake... Is there any possibility to restore previous data base? Is there any possibility to recreate all core data base in Presta shop. Build in module pscleaner is not working :/

 

Best regards!

Link to comment
Share on other sites

That is a long time ago that there was much discussion about nleft and nright. If you search the forum you will find many old issues about it. There even is somewhere a script to recreate nleft and nright. Prestashop itself contains also a function: Category::regenerateEntireNtree();. And finally it helps sometimes to create (and then delete if you want) a new category as that forces Prestashop to recreate the tree.

 

First of all, it looks like you have that field empty. That gives the MySql error. 

 

If you have a backup it should be easy to set it back.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...