select @i := $priority;
update todo,category set priority = (select @i := @i + 1) where cateid=category.id and status='new' and groups=0 and siteid=1 and priority>=$priority and todo.id!=190;
This statement runs mysql. But not execute in php mysql_query() command. Kindly help me.
Another way tries somthing,
Add Routine : stored procedure concept is not updated my phpmyadmin. It shows #1064 error on indicate the line 'select @'.
DELIMITER //
CREATE PROCEDURE FirstPro(IN st VARCHAR(10), IN grp INT(11),IN sid INT(11),IN pri INT(11), IN tid INT(11))
BEGIN
select @i := pri;
update todo,category set priority = (select @i := @i + 1) where cateid=category.id and status='st' and groups=grp and siteid=sid and priority>=pri and todo.id!=tid
END //
DELIMITER;
It shows
#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 'END' at line 5