0

I will be developing a website with PHP CodeIgniter(Framework) and MySQL. I already have done different project using the tools.

Here is something new to me ... I ask about my Professor if I could make a stored procedure on PHP-MySQL then, he suggested me this "MySQL Workbench". I already have experience making stored procedure in SQL and it work so fine to me.

I already "googled" a lot but I could not find any tutorial from scratch about PHP CodeIgniter and MySQL Workbench interaction. Could any body help me? Any tutorial/reference would help. Thank you

Kentot
  • 512
  • 5
  • 10
  • 26
  • 1
    They don't interact. MySQL Workbench is just a GUI client for MySQL, where it is somewhat easier to construct stored procedures than from the command line client. If you're already comfortable creating SPs with whatever MySQL client you currently use, go right ahead with it and don't bother with MySQL Workbench. The reason SPs are a tiny bit easier in the GUI is that you don't need to mess around with the [`DELIMITER`](http://stackoverflow.com/questions/10259504/delimiters-in-mysql) – Michael Berkowski Jan 25 '14 at 12:35
  • So is there any way in making stored procedure in CodeIgniter with out the use of the Workbench? – Kentot Jan 25 '14 at 12:39
  • Why do you need to make the SP in Codeigniter? Typically you would create your whole database schema outside PHP, using a MySQL client. Your PHP application generally won't be issuing `CREATE TABLE` or `CREATE PROCEDURE` statements. What is your process for creating your tables now? – Michael Berkowski Jan 25 '14 at 12:40
  • 1
    Though I can't say for sure, I'm doubtful that Codeigniter would supply a library for creating stored procedures in code. – Michael Berkowski Jan 25 '14 at 12:41
  • I want it for selecting, updating, deleting etc. in my database. I just want to organize through SP – Kentot Jan 25 '14 at 12:44
  • 1
    In codeigniter you would just call the SP with a normal `query()` call, and pass in its parameters. It's just a SQL query from codeigniter's point of view. But you asked about "_making a stored procedure_". You can make it in whatever MySQL client you already use to create your tables - the command line `mysql` or phpmyadmin or whatever. – Michael Berkowski Jan 25 '14 at 12:46
  • It has nothing to do with CodeIgniter. There's no intersect between CI and what you're looking for. – Hashem Qolami Jan 25 '14 at 12:51
  • Okay, thank you guys. I am now a bit enlightened with your thoughts. – Kentot Jan 25 '14 at 12:58

1 Answers1

1

Check How to write a stored procedure using phpMyAdmin and how to use it through php?

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

But I recommend to use MySQL Workbench instead.

More information: php.net stored procedure refrence

Community
  • 1
  • 1
saman khademi
  • 822
  • 1
  • 6
  • 13