Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Problem tracking a database value
#1

[eluser]markanderson993[/eluser]
I am trying to insert a new forum topic into a forum. When the user clicks the add_topic submit button and has all their fields filled in this code will execute. What it is doing is adding a topic title, topic_poster_id and topic submitted time into a topic table in a database. Also the post_subject and topic_id is inserted into a posts table in a database. Problem is, how do I know what the topic_id will be when I insert the topic_id into the post table?

Code:
$this->db->insert('sb_topics' array( 'topic_title' => $post_subject, 'topic_poster_id' => $this->session->userdata('id'), 'topic_time' => NOW(), 'forum_id' => $this->uri->segment(3) ))
                
$this->db->insert('sb_posts' array( 'post_subject' => $post_subject, 'post_message' => $post_message, 'poster_id' => $this->session->userdata['id'], 'topic_id' => $topic_id ) )


Messages In This Thread
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 09:27 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 09:33 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 09:40 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 09:46 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 09:50 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 09:58 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 10:13 PM
[SOLVED]Problem tracking a database value - by El Forum - 07-07-2008, 10:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB