Can I use MySQL and php on Ionic 2

Hi ! :slight_smile:
I would like to use a database in my app and MySQL look very appropriated for the things I want to do, in others words store messages, names, emails, googlemaps points, etc… And I want to know how to access to MySQL from Ionic 2. Can I use PHP ? If “yes”,how ? And if “no”, what am I supposed to use ?

Thanks for your answers.

Ionic is a client side technology (it’s JavaScript running in a web browser/WebView). PHP and MySQL are server side technologies. So you cannot run PHP and MySQL on Ionic.

You can have your Ionic app make HTTP requests to a PHP web (possibly REST) service that in turn talks to your MySQL database. But how to develop a RESTful web service in PHP is a completely separate thing from developing an Ionic app.

1 Like

Okay thanks but so how do I do to store messages, etc… what can you advise me ?

I use Firebase and I love it.

I can do the same things with Firebase as well as with MySQL ? And what language do I have to learn ?

Sorry, didn’t read the part where you said you wanted MySQL, Firebase is a non SQL database, but works very good with apps. The data structure is different and if there is one thing that I miss from SQL, are transactions.

I don’t know about your software requirements, but you should definitely give it a read.

okay thanks, I’ll do :wink:

@mirkonasato has done justice to your question. Ionic is client side because it uses angular. That is important because you application needs to respond fast.
However, you can make HTTP request to PHP/MYSQL where you can return JSON response to your ionic application .
Do let us know if you need help with making HTTP request to PHP/MYSQL. Also there are tons of tutorials on that online