This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>AngularJS, PHP, MySQL</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script> | |
<script src="js/app.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'config.php'; | |
$data = json_decode(file_get_contents("php://input")); | |
$request_type = $data->request_type; | |
// Get all records | |
if($request_type == 1){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = ""; /* Host name */ | |
$user = ""; /* User */ | |
$password = ""; /* Password */ | |
$dbname = ""; /* Database name */ | |
$con = mysqli_connect($host, $user, $password,$dbname); | |
// Check connection | |
if (!$con) { | |
die("Connection failed: " . mysqli_connect_error()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fetch = angular.module('myapp', []); | |
fetch.controller('userCtrl', ['$scope', '$http', function ($scope, $http) { | |
// Get all records | |
$http({ | |
method: 'post', | |
url: 'CRUD.php', | |
data: {request_type:1}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `users` ( | |
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
`username` varchar(80) NOT NULL, | |
`fname` varchar(80) NOT NULL, | |
`lname` varchar(80) NOT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Fill our vars | |
$dbname = ''; | |
$dbuser = ''; | |
$dbpass = ''; | |
$dbhost = ''; | |
$connect = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'"); |