Insert Data Into Database using AngularJS with PHP Mysql

Rate this post

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 :  CCAvenue Payment Gateway Integration in PHP

Database

[php]
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’);
[/php]

index.php

[php]

Step By step Insert All Data Into MYSQL Database using Angular JS with PHP

http://angular.min.js

Step By step Insert All Data Into MYSQL Database using Angular JS with PHP



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;
});
}
});

READ :  JQuery Ajax Add Remove Input Fields Dynamically

[/php]

add_data.php

[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”;
}
}
?>
[/php]

Example

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.

Leave a Reply

Your email address will not be published.