I'm trying to pass a JSON (result of a Google Place API) with Ajax to PHP. I think my problem is in PHP when it comes to manipulating the data, it follows a part of the code:
AJAX:
//GRAVA TODO O RETORNO NO BANCO...
$.ajax({
types: 'GET',
dataType: "json",
url: 'http://'+VARendereco+'/WB_CADASTRO_USUARIO3/www/busca.php',
data: "dados="+Dados_json+"&acao=salva_toda_busca_web",
success: function(data){
//alert(data[0].status);
//$('#sub-pagina').html(data);
//alert(data);
alert("Gravou_busca2");
}
});
PHP:
if($_GET["acao"] == "salva_toda_busca_web"){
//$matriz = stripslashes($_GET["dados"]);
$matriz = json_decode($_GET["dados"], true);
$itens = $matriz['results'];
//foreach ( $itens as $e ){
$SQL = "INSERT INTO tb_busca_geral (conteudo_busca, id_usuario, qt_resultados, local, lat, lon)VALUES('".$itens['name']."', 10, 5, '', '', '')";
$num = mysqli_query($serve, $SQL);
//echo $itens->name;
//}
}
It writes the record, more blank in this field ... If anyone has any ideas, thank you!
json (Google example, in this format):