Create Simple API using Angular JS and MySQL

API: Angular JS+Mysql

1. Create an api file.(student_name.php)
2. Create a file which would retrieve data from the database.(information_source_sql.php)

/* Keep following angularjs code in student_name.php */
<!DOCTYPE html>
<html >
<style>
table, th , td  {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f1f1f1;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</style>
<script src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js”></script>
<script>var app = angular.module(‘myApp’, []);
app.controller(‘customersCtrl’, function($scope, $http) {
$http.get(“http://yourdomain.com/yourfolder/information_source_sql.php”)
.then(function (response) {$scope.names = response.data.records;});
});
</script>
<body><div ng-app=”myApp” ng-controller=”customersCtrl”><table>
<tr ng-repeat=”x in names”>
<td>{{ x.Name }}</td>
<td>{{ x.Status }}</td>
</tr>
</table></div></body>
</html>
=================================================================
/* Keep following code in your information_source_sql.php file */
<?php
header(“Access-Control-Allow-Origin: *”);
header(“Content-Type: application/json; charset=UTF-8”);

$servername = “localhost”; // your hostname
$username = “root”; //your username
$password = “”; //your password
$dbname = “db1”; // your database name

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}

$result = $conn->query(“SELECT * FROM  `student` where status=’Active'”);

$outp = “”;
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != “”) {$outp .= “,”;}
$outp .= ‘{“Name”:”‘  . $rs[“information_source_name”] . ‘”,’;
$outp .= ‘”Status”:”‘. $rs[“status”]     . ‘”}’;
}
$outp ='{“records”:[‘.$outp.’]}’;
$conn->close();

echo($outp);
?>

274 thoughts on “Create Simple API using Angular JS and MySQL

  1. Pingback: Google
  2. Pingback: mt-gram.com
  3. Pingback: cursos online
  4. Pingback: xxx
  5. Pingback: fbv cursos grátis
  6. Pingback: Google
  7. Pingback: referat 13712
  8. Pingback: Bandar judi online
  9. Pingback: nfl merchandise
  10. Pingback: 토토정류장
  11. Pingback: Anal vibrators
  12. Pingback: pleasure balls
  13. Pingback: Sexy shayari
  14. Pingback: FIFA Coins
  15. Pingback: wand vibrator
  16. Pingback: Chicago SEO
  17. Pingback: Detroit SEO
  18. Pingback: shmmovers.com
  19. Pingback: curso online
  20. Pingback: hitachi magic wand
  21. Pingback: cock ring vibrator
  22. Pingback: Payday Loans
  23. Pingback: thruster vibrator
  24. Pingback: chwilówki
  25. Pingback: smartphone repair
  26. Pingback: vibrato lesson
  27. Pingback: vibrator reviews
  28. Pingback: adam and eve dildo
  29. Pingback: gay anal vibrator
  30. Pingback: Porn City XXX
  31. Pingback: vibrating panty
  32. Pingback: milking toy
  33. Pingback: realistic dildo
  34. Pingback: xxx porn
  35. Pingback: anal sex toys
  36. Pingback: penis enlargement
  37. Pingback: Mom
  38. Pingback: best anal toys
  39. Pingback: kegel balls
  40. Pingback: strap on dildo
  41. Pingback: 188bet
  42. Pingback: fun88
  43. Pingback: sekscamera
  44. Pingback: pc games download
  45. Pingback: full apps download
  46. Pingback: rencontres sexe
  47. Pingback: butt plug set
  48. Pingback: enema bag
  49. Pingback: Opblaasband
  50. Pingback: BlogBerries
  51. Pingback: free app for pc
  52. Pingback: free app for pc
  53. Pingback: play online games
  54. Pingback: hamptonbaylight
  55. Pingback: cursos gratuitos
  56. Pingback: webcam babes
  57. Pingback: shemale dating
  58. Pingback: p spot massager
  59. Pingback: warm dildo
  60. Pingback: p spot massager
  61. Pingback: realistic dildo
  62. Pingback: powerful vibe
  63. Pingback: sex toys
  64. Pingback: suction cup dildo
  65. Pingback: penis pumping
  66. Pingback: anal play
  67. Pingback: sex toy kit
  68. Pingback: anal cleaning
  69. Pingback: anal training kit
  70. Pingback: Porn
  71. Pingback: easy online loans
  72. Pingback: big jelly dildo
  73. Pingback: warming rabbit
  74. Pingback: hydrastep
  75. Pingback: foreplay games
  76. Pingback: viagra
  77. Pingback: gay sex toys
  78. Pingback: blockchain advisor
  79. Pingback: satta matka
  80. Pingback: double ended dildo
  81. Pingback: thick dildo
  82. Pingback: silicone bullet
  83. Pingback: male masturbator
  84. Pingback: treatment vagina
  85. Pingback: bdsm sex toys
  86. Pingback: porn city
  87. Pingback: pornland
  88. Pingback: butterfly sex toy
  89. Pingback: cyberskin stroker
  90. Pingback: best massage ever
  91. Pingback: rubbish bin hire
  92. Pingback: suction cup dongs
  93. Pingback: male toys
  94. Pingback: bullet sex toy
  95. Pingback: leader bondage
  96. Pingback: newest vibrators
  97. Pingback: vibrating egg
  98. Pingback: bondage toys
  99. Pingback: porn land
  100. Pingback: best real orgasms
  101. Pingback: lingerie stocking
  102. Pingback: minoxidil 15%
  103. Pingback: trixie hundeseng
  104. Pingback: Julia Ann Porn
  105. Pingback: Fashion Station
  106. Pingback: Pentair Light
  107. Pingback: sexboer
  108. Pingback: gratis films
  109. Pingback: geile sex filmpjes
  110. Pingback: pornofilmpjes
  111. Pingback: iptv dreamlink
  112. Pingback: liteblue
  113. Pingback: finger vibrator
  114. Pingback: virtual visa card
  115. Pingback: high tech vibrator
  116. Pingback: опешить
  117. Pingback: acpi ite8708
  118. Pingback: cheap flights
  119. Pingback: hundeseng xxl
  120. Pingback: penis vacuum pump
  121. Pingback: nipple bondage
  122. Pingback: walmartone
  123. Pingback: walmartone
  124. Pingback: Bluechew reviews
  125. Pingback: type 1 diabetes
  126. Pingback: outlook sign in
  127. Pingback: sex toys haul
  128. Pingback: gay lubricant
  129. Pingback: podcast
  130. Pingback: qqonline
  131. Pingback: blowjob
  132. Pingback: mens c ring
  133. Pingback: judi online
  134. Pingback: faceit hacks
  135. Pingback: Hotmail login
  136. Pingback: hasta karyolası
  137. Pingback: سکس نیمه
  138. Pingback: online marketing
  139. Pingback: gay mesh underwear
  140. Pingback: pleasure ring
  141. Pingback: YtMp3

Leave a Reply