sql_error[0]: select pg.rang from (SELECT (@rn:=@rn+1)*10 rang, p.id, p.cat_id FROM con p,(SELECT @rn:=0) r WHERE p.cat_id= AND p.typ=1 AND p.stat IN (1,2) ORDER BY p.rang) pg where pg.id= -> You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND p.typ=1 AND p.stat IN (1,2) ORDER BY p.rang) pg where pg.id=' at line 1