Hieronder mijn blueprint van mijn functie:
Code: Selecteer alles
function postNewTopic(){
$topic_id = "";
$forum_id = "";
$post_id = "";
$user_id = "";
$current_time = time();
// topic toevoegen
$sql = "INSERT INTO phpbb_topics (forum_id, topic_title, topic_poster) VALUES ($forum_id, 'topic titel', $user_id)";
// $topic_id = ophalen insert id
// post toevoegen
$sql = "INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, post_time, poster_ip) VALUES ($topic_id, $forum_id, $user_id, $current_time, 'poster_ip')";
// $post_id = ophalen insert id
// topic updates
$sql = "UPDATE phpbb_topics SET topic_first_post_id = $post_id, topic_last_post_id = $post_id WHERE topic_id = $topic_id";
// post tekst toevoegen
$sql = "INSERT INTO phpbb_posts_text (post_id, bbcode_uid, post_subject, post_text ) VALUES ($post_id, bb_uid, subject, text);
}
?>