PHP mysql with Connecting to Database Using AngularJS

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


<title> AngularJS : How to connect AngularJS with MySQL database </title>

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

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

 <h1>AngularJS CRUD: Example Using MySQLi Database</h1>
<div>
 
<table>
  <tr>
    <td>{{ x.productname }}</td>
    <td>{{ x.productprice }}</td>
  </tr>
</table>
 
<a href="https://infinityknow.com/" target="_blank" title="AngularJS CRUD: Example Using MySQLi Database" class="download">infinityknow.com</a>
</div>
 

var app = angular.module('w2App', []);
app.controller('perpoleCtrl', function($scope, $http) {
   $http.get("product_file.php")
   .then(function (response) {$scope.person = response.data.records;});
});

 



product_file.php

READ :  Top 10 Advanced ASP.NET MVC Interview Questions And Answers

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

Example

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!.

READ :  Vue Js Image Gallery with thumbnails - vuejs lightbox

Searches related to : Buy Facebook Likes

Add a Comment

Your email address will not be published. Required fields are marked *