A few weeks ago I started using AngularJs for an application of the typical administration style.
My question is this:
I use it with PHP, using the method $http.post
sent the parameters to a file 'file.php', who takes the variables and runs a query on MySQL.
I also use $http.get
to receive arrays from another .php file.
Now the question, how can I use $http.post
and $http.get
in the same function?
Suppose that in php I need to do something like this:
<?php
include('conn.php');
$data = json_decode(file_get_contents('php://input'));
$variable = $conn->real_escape_string($data->variable);
$query = 'INSERT INTO datos VALUES ("'.$variable.'")';
$conn->query($query);
print $query;
?>
I need to pass parameters to php, that php execute what I need, and that I return something "x" by print
, therefore in Angular, I need to send the parameters, and then receive them, all from the same file, Any ideas?