3raser Posted June 29, 2010 Share Posted June 29, 2010 I'm adding a category system to my forum script, and it's almost done. I'm just wondering, how am I suppose to get the thread ID to insert into category_holder? mysql_query("INSERT INTO topics VALUES ('', '$ip', '$date', '$session', '', '$topic_title', '$topic_message', '0')"); mysql_query("INSERT INTO category_holder (cat_id, topic_id) VALUES ('$category', '')"); Link to comment https://forums.phpfreaks.com/topic/206228-how-do-i-get-the-topic-id/ Share on other sites More sharing options...
ChemicalBliss Posted June 29, 2010 Share Posted June 29, 2010 Handy your using mysql, an easy function: mysql_query("INSERT INTO topics VALUES ('', '$ip', '$date', '$session', '', '$topic_title', '$topic_message', '0')"); $id = mysql_insert_id(); mysql_query("INSERT INTO category_holder (cat_id, topic_id) VALUES ('$category', '$id')"); -cb- Link to comment https://forums.phpfreaks.com/topic/206228-how-do-i-get-the-topic-id/#findComment-1078942 Share on other sites More sharing options...
3raser Posted June 29, 2010 Author Share Posted June 29, 2010 Handy your using mysql, an easy function: mysql_query("INSERT INTO topics VALUES ('', '$ip', '$date', '$session', '', '$topic_title', '$topic_message', '0')"); $id = mysql_insert_id(); mysql_query("INSERT INTO category_holder (cat_id, topic_id) VALUES ('$category', '$id')"); -cb- Thank you! Thats a new function to me. Thank you, once again! Link to comment https://forums.phpfreaks.com/topic/206228-how-do-i-get-the-topic-id/#findComment-1078945 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.