Creating a stored procedure using PHP

I am trying to make a setup file for a website I’m developing, and am having the database tables and stored procedures created automatically. However, I’m having issue getting the stored procedures to be created. Here is my code:


$db->Q("
	DELIMITER $$
	CREATE PROCEDURE `Database`.`Procedure_Name`(in sp_uid mediumint(20) unsigned, in sp_user varchar(15), in sp_pass varchar(20), in sp_email varchar(30))
	BEGIN 
		Insert Into Table Values (sp_uid, sp_user, md5(sp_pass), sp_email, '1', '1', '0');
		Select true;
	END$$
");

Assume that the “$db->Q()” works just fine, as I’m having issues no where else with it. This automatically connects to the database and runs a query with whatever is inside the “()”. The tables are being created just fine, but no stored procedures are being created. I’ve tried everything I can think of, and googled my question many different ways without finding an answer or work-through. Does anyone know what I am doing wrong?

Thanks in advance.

Also, the error is of no help.

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 ‘DELIMITER $$ CREATE PROCEDURE U_C_D.Admin_Login_Create(in sp_uid mediumin’ at line 1

Well, I ended up fixing it… I just took out the delimiter… I don’t know why that would work, or why I didn’t try that before. The query looks like this now.

$db->Q("
   CREATE PROCEDURE `Database`.`Procedure_Name`(in sp_uid mediumint(20) unsigned, in sp_user varchar(15), in sp_pass varchar(20), in sp_email varchar(30))
   BEGIN
      Insert Into Table Values (sp_uid, sp_user, md5(sp_pass), sp_email, '1', '1', '0');
      Select true;
   END
");