I have a function that works inside my script but when I try to run it on my Sequel Pro MariaDB to add it to the function list, I get a bunch of errors.
drop function if exists related_count;
create function related_count(parent int(11)) returns int(11)
begin
declare count int(11) default 0;
while parent!=0 and count<10 do
set count=count+1;
set parent=(select related from category where id=parent);
end while
return count
end