I'm not sure, but, at the first DELIMITER try to put $$
And after the last END put $$
Question
I am getting this error
#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 'lstart, lend; END IF; ELSE IF lstart = -1 THEN select count(*) a' at line 8"
on this stored procedure creation on server but in my localhost phpmyadmin it is creating without any error?
DELIMITER
create procedure getallmedia(IN cat int(2), IN asc_desc varchar(5), IN lstart int(11), IN lend int(11))
BEGIN
IF cat = -1 THEN
IF asc_desc = 'asc' THEN
IF lstart = -1 THEN
select count(*) as result from bc_media where id <> -1;
ELSE
select * from bc_media where id <> -1 limit lstart, lend;
END IF;
ELSE
IF lstart = -1 THEN
select count(*) as result from bc_media where category = cat;
ELSE
select * from bc_media where category = cat order by id desc limit lstart, lend;
END IF;
END IF;
ELSE
IF asc_desc = 'asc' THEN
IF lstart = -1 THEN
select count(*) as result from bc_media where category = cat;
ELSE
select * from bc_media where category = cat limit lstart, lend;
END IF;
ELSE
IF lstart = -1 THEN
select count(*) as result from bc_media where category = cat;
ELSE
select * from bc_media where category = cat order by id desc limit lstart, lend;
END IF;
END IF;
END IF;
END
DELIMITER ;
Help me out please :(
No correct solution
OTHER TIPS
I'm not sure, but, at the first DELIMITER try to put $$
And after the last END put $$