Last active
June 22, 2017 12:04
-
-
Save michaeldeboeve/022b3e2097d7f2116356354d3917b5ed to your computer and use it in GitHub Desktop.
Load .php file in angular
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
$http.get('/path/to/ami.php') | |
.then(function(response){ | |
$scope.myResult = response.data; | |
}); |
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 | |
// Connect to the Database | |
include 'db_connect.php'; | |
// Query from Database | |
include 'db_main_query.php'; | |
mysqli_close($conn); | |
?> | |
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 | |
$servername = "localhost"; | |
$username = "root"; | |
$password = "root"; | |
$dbname = "myDB"; | |
$conn = mysqli_connect($servername, $username, $password, $dbname); | |
if(!$conn){ | |
die("Connection failed: " .mysqli_connecet_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
<?php | |
$query = "SELECT * FROM table"; | |
$data = array(); | |
$result = mysqli_query($conn, $query); | |
if(mysqli_num_rows($result) > 0){ | |
while($row = mysqli_fetch_assoc($result)){ | |
$data[] = $row; | |
} | |
} else { | |
echo "0 results"; | |
}; | |
print json_encode($data); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment