-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinscoment.php
More file actions
22 lines (18 loc) · 770 Bytes
/
inscoment.php
File metadata and controls
22 lines (18 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
require_once('connection/connection.php');
$sqlComentario = "INSERT INTO comentarios(idArtigo,comentario,nome) VALUES(?,?,?)";
$stmtComentario = $conn->prepare($sqlComentario);
if ($stmtComentario === FALSE) {
die("Erro no SQL: " . $sqlComentario . " Error: " . $conn->error);
}
$idArtigo = $_POST['addArtigo'];
$nome=$_POST['addNome'];
$comentario=$_POST['addComentario'];
$stmtComentario->bind_param('iss', $idArtigo,$comentario,$nome);
$stmtComentario->execute();
$stmtComentario->close();
//$resposta = array('nome'=>$_POST['addNome']);
//$resposta += array('comentario'=>$_POST['addComentario']);
$resposta = array('status'=>'Obrigado pelo comentário!');
echo json_encode($resposta);
?>