Hi friends, hope you are doing well. In today’s post i will share a very important things with you. Now days AngularJS is the best option to develop next web application. If you are going to start a new project, then why not choose AngularJS as front-end and PHP as back-end.

In this post i will let you know how to get data from mysql using AngularJS and PHP. Follow the below steps and use simple and easy snippets to get mysql data using angulaJS.

angularJS-mysql example

How to Fetch Data From a PHP Server Running MySQL

Below is the complete example to display the data from mysql database using angularJS and PHP. Add below angularJS file.

First open phpmyadmin in your browser and create a test database. Select test database and create user table by using below code. Open SQL tabs and copy paste below sql queries to create user table.

Copy and paste below SQL queries to insert some sample users data.


Benefits of using AngularJS 2.0 in your next web application
5 Best AngularJS Frameworks To Develop Next Generation Apps Quickly

AngularJS code get mysql data

Below angularJS code will call the PHP based API to get users data from mysql table.

Now call the usersCtrl to display the all users data in your webpage.

How to get data from mysql using AngularJS and PHP

Below is the complete code to get data from mysql table using angularJS and PHP.

Below is the output of above example.