I want to be able create stored procedures using phpMyAdmin
and later on use it through php.
From what I know, I found out that we cannot manage stored procedures through phpMyAdmin
.
What other tool can manage stored procedure?
I am not even sure if it is better option to use stored procedure through PHP. Any suggestion?
You can view your created procedures under 'Routines' tab itself. Show activity on this post. In phpMyAdmin you can create the stored procedure in the SQL window.
To call a stored procedure from a PHP application, you execute an SQL CALL statement. The procedure that you call can include input parameters (IN), output parameters (OUT), and input and output parameters (INOUT).
phpMyAdmin is a free software tool written in PHP that is intended to handle the administration of a MySQL or MariaDB database server. You can use phpMyAdmin to perform most administration tasks, including creating a database, running queries, and adding user accounts.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With