PHP mysql with Connecting to Database Using AngularJS
Welcome to the In infinityknow.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.For PHP mysql with Connecting to Database Using AngularJS
Fetching Data From a PHP Server Running MySQL
index.html
[php]
table, th , td {
border: 2px solid grey;
border-collapse: collapse;
padding: 14px;
}
table tr:nth-child(odd) {
background-color: #D3D3D2;
}
table tr:nth-child(even) {
background-color: #FDFDFD;
}
AngularJS CRUD: Example Using MySQLi Database
{{ x.productname }} | {{ x.productprice }} |
var app = angular.module(‘w2App’, []);
app.controller(‘perpoleCtrl’, function($scope, $http) {
$http.get(“product_file.php”)
.then(function (response) {$scope.person = response.data.records;});
});
[/php]
product_file.php
[php]
query(“SELECT productname, productdesc, productprice FROM productsmst”);
$outp = “”;
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != “”) {$outp .= “,”;}
$outp .= ‘{“productname”:”‘ . $rs[“productname”] . ‘”,’;
$outp .= ‘”productdesc”:”‘ . $rs[“productdesc”] . ‘”,’;
$outp .= ‘”productprice”:”‘. $rs[“productprice”] . ‘”}’;
}
$outp ='{“records”:[‘.$outp.’]}’;
$conn->close();
/* here database connecttion closed. /*
echo($outp);
?>
[/php]
We hope you get an idea about PHP mysql with Connecting to Database Using AngularJS
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.
We hope This Post can help you…….Good Luck!.