Hi I am relatively new to PHP and MySQL, the question I have is.
I am attempting to create some stored procedures on my server and not having any luck.
I am creating PHP files to run and create my queries other that command prompt, the one I am having trouble with is the syntax for creating a stored procedure. the site project that I am creating requires multiple stored procedures, and I would like to be able to use this feature instead of having to implement all the queries into my code.
$sql = "DELIMITER $$
CREATE PROCEDURE select_categories (type VARCHAR(6))
BEGIN
IF type = 'coffee' THEN
SELECT FROM general_coffees ORDER by category;
ELSEIF type = 'other' THEN
SELECT FROM non_coffee_categories ORDER by category;
END IF;
END$$
DELIMITER ";
I am getting an error on the line (IF type = ...)
any help would be greatly appreciated!
thanks