1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
<?php
$titre_edit = mysql_real_escape_string(trim($_POST['titre']));
$description = mysql_real_escape_string(trim($_POST['contenu']));
//On entre le topic dans la base de donnée en laissant
//le champ topic_last_post à 0
mysql_query("INSERT INTO forum_topic (forum_id, topic_titre, topic_createur, topic_vu, topic_time, topic_genre, topic_last_post, topic_post, validation_annonce)
VALUES('".$forum."', '".$titre_edit."', '".intval($_SESSION['id_utilisateur'])."', '1', '".$temps."','".$statut_annonce."', '0', '0', '0' )")
or die ("Un problème est survenu lors de l'envoi du message");
//Je récuper le dernier id
$nouveautopic = mysql_insert_id();
$stmt = $bdd->prepare('INSERT INTO forum_topic(forum_id, topic_titre, topic_createur, topic_vu, topic_time, topic_genre, topic_last_post, topic_post, validation_annonce)
VALUES(:id,:titre,:createur,:vu,:time,:genre,:last_post,:post,:valid_annonce)');
$stmt->bindValue('id', $forum, PDO::PARAM_INT);
$stmt->bindValue('titre', $titre_edit, PDO::PARAM_STR);
$stmt->bindValue('createur', $_SESSION['id_utilisateur'], PDO::PARAM_INT);
$stmt->bindValue('vu', 1, PDO::PARAM_INT);
$stmt->bindValue('time', $temps, PDO::PARAM_INT);
$stmt->bindValue('genre', $statut_annonce, PDO::PARAM_STR);
$stmt->bindValue('last_post', 0, PDO::PARAM_INT);
$stmt->bindValue('post', 0, PDO::PARAM_INT);
$stmt->bindValue('valid_annonce', 0, PDO::PARAM_INT);
$stmt->execute();
//Je récuper le dernier id
$nouveautopic = $bdd->lastInsertId;
?> |