トピック ID を取得するにはどうすればよいですか? ユーザーが投稿した後、ユーザーをトピックにリダイレクトできますか? 切り替えると、投稿に topic_id を挿入できません。うーん。
$stmt = $db->prepare("INSERT INTO topics (subject, posted, first_post_id, last_post, last_post_id, forum_id)
VALUES (:subject,:posted,:first_post_id,:last_post,:last_post_id,:forum_id)");
$stmt->execute(array(':subject'=>$subject,':posted'=>time(),':first_post_id'=>$cid,':last_post'=>time(),':last_post_id'=>$cid,':forum_id'=>$f));
$stmt = $db->prepare("INSERT INTO posts (poster_id, poster_ip, message, posted, topic_id)
VALUES (:poster_id,:poster_ip,:message,:posted,:topic_id)");
$stmt->execute(array(':poster_id'=>$cid,':poster_ip'=>$_SERVER['REMOTE_ADDR'],':message'=>$message,':posted'=>time(),':topic_id'=>$db->lastInsertId()));
header("Location: /thread/".$db->lastInsertId()); // This will get the post ID not topic ID that i want it to