views:

914

answers:

3

I want to create stored procedures through phpmyadmin and later on use it on php. But I dont know how to?. From what I know, I found out that, we cannot manage stored procedures through phpmyadmin. What other tool can manage stored procedure?

And I am not sure if it is better option to use stored procedure instead?

A: 

Try Toad for MySQL - its free and its great.

Ronaldo Junior
A: 

Sorry dude u are out of luck, we cannot manage stored procedures through phpmyadmin

piemesons
-1 This is blatantly wrong, you CAN manage stored procedures using phpMyAdmin since you can add/drop them using simple queries. See my answer below.
wimvds
+1  A: 

Since a stored procedure is created, altered and dropped using queries you actually CAN manage them using phpMyAdmin.

To create a stored procedure, you can use the following (change as necessary) :

CREATE PROCEDURE sp_test()
BEGIN
  SELECT 'Number of records: ', count(*) from test;
END//

And make sure you set the "Delimiter" field on the SQL tab to //.

Once you created the stored procedure it will appear in the Routines fieldset below your tables (in the Structure tab), and you can easily change/drop it.

To use the stored procedure from PHP you have to execute a CALL query, just like you would do in plain SQL.

wimvds