I am using angular's $http.get function to call a PHP script file to retrieve data
var $promise = $http.get("../php-bin/example.php",obj).success(function(data) {
console.log(data);
});
The php is supposed to just get data from a mysql db to figure out a way to get data into my app
$user = json_decode(file_get_contents('php://input'));
$email = $user->email;
$pass = $user->pass;
$con = //a mysql_connection;
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$validateEmail = "SELECT `Email` FROM `newUsers` WHERE `Email` = '$email' ";
if ($result = mysqli_query($con,$validateEmail)) {
if ($result->num_rows == 1){
$date = '2014-08-13';
//$sql = "INSERT INTO newUsers (Email, CreationDate, UserRef, Type, id) VALUES ('$email','$date','$email','Host','$ssid')";
$sql = "SELECT `email` FROM `newUsers` WHERE `hashpass` = '$pass' ";
$result = mysqli_query($con,$sql);
$row = mysqli_fetch_assoc($result);
return $row;
//I never receive this data in the angular app.
}
}
mysqli_close($con);
?>
Could some one point me to the correct way to do this.