Erreur syntaxe AND version mysql5.0
	
	
		Bonjour!
Je passe un site sur un nouveau serveur et certains scripts génèrent des erreurs..
je dispose de ce script-ci
	Code:
	
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
   |     global $db;
   $sql = 'SELECT lft, rgt FROM `'.$table.'` WHERE category__auto_id='.$root.';';
   $result = mysql_query($sql);
   $row = mysql_fetch_array($result);
 
   $right = array();
   $sql = 'SELECT * FROM `'.$table.'` WHERE lft BETWEEN '.$row['lft'].' AND '.$row['rgt'].' and category_enabled <> 0 ORDER BY lft ASC;';
 
   $result = mysql_query($sql) or die("Erreur SQL : $query<br/>".mysql_error());
 
   $i = 0;
   $lastspacer = 0;
   while ($row = mysql_fetch_array($result)) {
       if (count($right)>0) {
           // check if we should remove a node from the stack
           while ($right[count($right)-1]<$row['rgt']) {
               array_pop($right);
           }
       }
 
                $array[$i]['spacercount'] = count($right);
                $array[$i]['lastspacercount'] = $lastspacer;
                $array[$i]['spacerdiff'] = abs($lastspacer - count($right));
                $array[$i]['auto_id'] = $row['category__auto_id'];
                $array[$i]['name'] = $row['category_name'];
                $array[$i]['safename'] = $row['category_safe_name'];
                $array[$i]['color'] = $row['category_color'];
                $array[$i]['parent'] = $row['category_parent'];
                $array[$i]['parent_name'] = GetCatName($row['category_parent']);
                $array[$i]['subcat_count'] = GetSubCatCount($row['category__auto_id']);
                $array[$i]['parent_subcat_count'] = GetSubCatCount($row['category_parent']);
 
 
                $lastspacer = count($right);
                $i = $i + 1;
       $right[] = $row['rgt'];
   }
 
    if($showRoot == FALSE){$array = my_array_unset($array,0);}
    return $array;
} | 
 L'erreur est la suivante : 
	Citation:
	
		
		
			Erreur SQL : 
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 and category_enabled <> 0 ORDER BY lft ASC' at line 1
			
		
	
 et effectivement, lorsque je tente d'afficher la variable $sql, elle me renvoie
	Citation:
	
		
		
			SELECT * FROM `tab_categories` WHERE lft BETWEEN AND and category_enabled <> 0 ORDER BY lft ASC
			
		
	
 il semble que mes valeurs lft et rgt soient nulles. Je suis peu familier... je suis allé voir la doc mysql ici http://dev.mysql.com/doc/refman/5.0/...operators.html (version 5.0) sans réussir à cerner le problème... J'espère que quelqu'un pourra me donner une piste. Merci d'avance!