Jump to content

How do I get the topic ID?


3raser

Recommended Posts

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

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-

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.