Page 1 of 1
SQL Procedures and Functions
Posted: Fri Dec 30, 2011 8:35 pm
by bowersbros
If i were to make a SQL function or procedure, I assume I can store it in a seperate file (most likely .sql file) but how would i go about including it, and calling the function etc?
Re: SQL Procedures and Functions
Posted: Sun Jan 01, 2012 1:26 am
by jacek
I'm not sure it's possible in a nice way, you can do a shell_exec as described here
http://stackoverflow.com/questions/4027 ... les-in-php but that will open new connection for every query (slow) and uses shel_exec (slower).
Not tried, but could you do
mysql_query(file_get_contents('thingy.sql'));
?
Re: SQL Procedures and Functions
Posted: Sun Jan 01, 2012 2:17 am
by bowersbros
Apparently
mysql_query('call procedure_name()');
Will work