My data does not go to DB using ionic and php

1

I'm developing an app on Ionic. When saving, the following message appears in the console:

  

link 500 (Internal Server Error) ionic.bundle.js: 19346 POST

Follow my codes

angle controller:

angular.module('app.controllers', [])

.controller('loginCtrl', function($scope) {

})

.controller('enderecoCtrl', function ($scope, $http) {

    $scope.adicionarEndereco = function (endereco){
        $http.post("php/salvaEndereco.php", endereco).success(function (data){

        });
    }
})

php:

<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type,X-Prototype-Version,X-Requested-With');

include_once("con.php");

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);

$cep = $request['cep'];
$uf = $request['uf'];
$cidade = $request['cidade'];
$bairro = $request['bairro'];
$logradouro = $request['logradouro'];

$insert = "INSERT INTO cep VALUES(NULL, '$cep', '$uf', '$cidade', '$bairro', '$logradouro')";

mysqli_query($con, $insert);
?>
    
asked by anonymous 27.01.2016 / 19:37

0 answers