Im creating a stored procedure in phpmyadmin, which get the event category list. The condition im using, im sending a parameter 'e_range' where i get the list on the basis of whatever i set the range on this parameter 3, 4 etc. but im getting an error in while executing this script:
#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 'e_range; else select category_id, category_name, category_thumb from category' at line 4
CREATE PROCEDURE `sp_category_list`(IN e_range int)
BEGIN
if(e_range != 0) then
select category_id, category_name, category_thumb from category_list order by category_name limit e_range;
else
select category_id, category_name, category_thumb from category_list order by category_name;
END if;
END$$
Now problem is that, this script working good in my localhost pc. but im getting these error on my webserver CPANEL's phpmyadmin. the MySQL keyword 'LIMIT' is not taking the value through parameter. or maybe not recognizing it. but when i remove this parameter from the select command and set the static number on this, it will work:
select category_id, category_name, category_thumb from category_list order by category_name limit 5;
now what is the procedure, so i will get the list through my given parameter.
Thank you :)