We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Easiest way to integrate MySQL...?

Development and Programming

ladams1949's avatar
ladams1949
100 posts
14 years ago
ladams1949's avatar ladams1949

I have a pretty straight forward application need. A. Two separate input forms ==> insert to two separate MySQL tables B. Joined query on these two tables ==> retrieved recs ==> table ==> display

I am currently on EE 2.2.2.

What might be my quickest and easiest approach?

Any and all suggestions are very much appreciated. Code examples I could follow and clone would be absolutely super.

Thanks!! Larry A.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
14 years ago
Kevin Cupp's avatar Kevin Cupp

Hi Larry,

If you’re comfortable with writing a third-party addon, that would be the best way to insert into a database. If not, you can add PHP to your templates to achieve the same thing, we usually don’t recommend this because PHP in templates takes a small performance hit, but it may be easier for you to do. Let me know which you would like to do.

As for querying and displaying data, you can use the Query module which allows you to easily run a query and display the results in a template:

http://ellislab.com/expressionengine/user-guide/modules/query/index.html

Kevin

       
ladams1949's avatar
ladams1949
100 posts
14 years ago
ladams1949's avatar ladams1949

Thanks, Kevin. Went to EECI2011 last week and that was pretty much the advice there as well, though I may look to encapsulate CI database functions for the add-on. Will be a learning opportunity. 😉

Does query work against an external MySQL databsae, or just EE’s?

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
Does query work against an external MySQL databsae, or just EE’s?

Hi Larry,

You can query an external DB. You would just need to create a separate connection to that database with the CI database object. It’s pretty simple and there are some decent examples here: http://ellislab.com/codeigniter/user-guide/database/connecting.html

You may need to cover some bases regarding IP restriction, ports etc when connection to a database on a different server.

Best, Erik

       
ladams1949's avatar
ladams1949
100 posts
14 years ago
ladams1949's avatar ladams1949

Thanks, Erik. Nice job last week, BTW. I’m setting up and populating the database right now to give me something against which to exercise my logic. Then will see how it goes.

       
Etheya's avatar
Etheya
213 posts
13 years ago
Etheya's avatar Etheya

Attempting to do something similar at present.. but cant find that file from the link to try and even attempt this..

       
ladams1949's avatar
ladams1949
100 posts
13 years ago
ladams1949's avatar ladams1949

Here are some additional suggestions I have received…

I would suggest first building a very simple codeigniter application to get familiar with the structure. EE uses a lot of CI libraries, including the database driver. Then when you get started on EE, take a look at the module development tutorial: http://ellislab.com/expressionengine/user-guide/development/module_tutorial.html Especially browse through the example code. You’ll see that it also creates its own tables. It’s a good idea to keep your data separate from ours, but you can still leverage EE in the process. Especially on the frontend you’ll see that building your own template tags is very, very simple. To process form data, take a look at creating action request, they can do the processing and then redirect the user to a result page: http://ellislab.com/expressionengine/user-guide/development/modules.html#install

I particulary like the idea of building one’s own EE tags to encapsulate MySQL calling logic. I’m still trying to get to this myself, but have been sidetracked a bit of late.

Thanks

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.