Insert Data Into Database using AngularJS with PHP Mysql

Insert Data Into Database using AngularJS with PHP Mysql

Also Read : first love marriage in the world

Insert Data Into Database using AngularJS with PHP Mysql

In this Post We Will Explain About is Insert Data Into Database using AngularJS with PHP Mysql With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to AngularJS Tutorial with PHP – Insert Data into Mysql DatabaseExample

In this post we will show you Best way to implement php – Fetch and insert data into mysql using angularjs, hear for Insert Data Into Database in AngularJSwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Angular Resource Encode and Decode URL

Database

CREATE TABLE `user_master` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`user_email` varchar(255) NOT NULL,
`user_age` varchar(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `user_master` (`id`, `name`, `user_email`, `user_age`) VALUES
(2, 'dsp', '[email protected]', '26');

index.php

Also Read : tamilblasters, 9kmovie, filmygod, hdhub4u, vegamovies, tamilrockers website link and 1377x proxy.




<title>Step By step Insert All Data Into MYSQL Database using Angular JS with PHP</title>


<a href="http://angular.min.js">http://angular.min.js</a>


<div class="container">
<h1 align="center">Step By step Insert All Data Into MYSQL Database using Angular JS with PHP</h1>
<div>
<label>User Name</label><br />
<label>UserEmail</label><br />
<label>User Age</label><br />

</div>
</div>
<!-- Script -->

var app = angular.module("sa_insert", []);
app.controller("controller", function($scope, $http) {
	$scope.insert = function() {
		$http.post(
		"add_data.php", {
			'name': $scope.name,
			'user_email': $scope.user_email,
			'user_age': $scope.user_age
			}
		).success(function(data) {
			alert(data);
			$scope.name = null;
			$scope.user_email = null;
			$scope.user_age = null;
		});
	}
});



add_data.php

 0) {
	$name = mysqli_real_escape_string($db_conn, $data->name);
	$user_email = mysqli_real_escape_string($db_conn, $data->user_email);
	$user_age = mysqli_real_escape_string($db_conn, $data->user_age);
	$sql_query = "INSERT INTO user_master(name, user_email, user_age) VALUES ('$name', '$user_email', '$user_age')"; 
	if(mysqli_query($db_conn, $sql_query)) {
		echo "Insert USER Data Successfully";
	}
	else 
	{
		echo "Failed";
	}
}
?>

Example

READ :  Angular Retrieve Multiple Checkbox Selected Options

I hope you have Got What is Insert the data to MYSQL database on PHP page using AngularJS And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.