MonsterM

Bonjour;
J'ai suivi le tuto mais j'ai un souci sur la validation et la suppression de com dans la partie admin.
J'ai utilisé à bootstrap par contre je mets mon code ici si une personne peut m'aider ça serait top ! :)

le code :

dashboard.php :
<!-- Start commentaires non lus -->
<div class="container">
<div class="row">
<div class="col-md-12 mt-4 text-center">
<h4 class="text-presentation">Commentaires non lus</h4>
</div>
</div>
<?php
$comments = get_comments();
?>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th scope="col">Article</th>
<th scope="col">Commentaire</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($comments)) {
foreach ($comments as $comment) {
?>
<tr id="commentaire_<?= $comment->id ?>">
<td><?= $comment->title ?></td>
<td><?= substr($comment->comment, 0, 2000); ?></td>
<td>
<a href="#" id="<?= $comment->id ?>"
class="btn btn-success see_comment"><i class="fa fa-check"></i></a>
<a href="#" id="<?= $comment->id ?>"
class="btn btn-danger delete_comment"><i class="fa fa-times"></i></a>
</td>
</tr>

<?php
}
}else{
?>
<tr>
<td></td>
<td>Aucun commentaire à valider</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<!-- End commentaires non lus -->

dashboard.func.js :
$(document).ready(function(){

$(".see_comment").click(function(){
var id = $(this).attr("id");
$.post('ajax/see_comment.php',{id:id},function(){
$("#commentaire_"+id).hide();
});
});

$(".delete_comment").click(function(){
var id = $(this).attr("id");
$.post('ajax/delete_comment.php',{id:id},function(){
$("#commentaire_"+id).hide();
});
});

});

delete_comment.php:
<?php //Supprimer le com

require "../../functions/main-functions.php";

$db->exec("DELETE FROM comments WHERE id = {$_POST['id']}");

see_comment.php:
<?php //Valider le com

require "../../functions/main-functions.php";

$db->exec("UPDATE comments SET seen='1' WHERE id='{$_POST['id']}'");

Le 07/03/2018 à 12:34