Automated Topic (Technics)

by Patrick Riley ⌂ @, Louisville,KY, Tuesday, March 24, 2009, 04:48 (5509 days ago)

Hi,

I have adapted MLF to a Facebook application and have a fairly good understanding of the source code, however I'm having trouble determining how the $id gets created for new topics (this is then inserted in the mlf2_entries table for that post). It usually matches the "tid" if it is a parent post... it is assigned somewhere in includes/posting.inc.php. I am considering auto generating a sticky topic each time a new category is created in the forum (my application generates "courses" for categorys), and I would like a topic auto created in each course. It seems like a simple sql insert into the entries table, but I need to determine how this id/tid is generated first... the rest of the fields inserted into this entry table seem fairly straight forward for me.

Thanks a ton for your work! This is a fantastic forum. :-)

-patrick

Avatar

Automated Topic

by Alex ⌂, Tuesday, March 24, 2009, 07:59 (5509 days ago) @ Patrick Riley

Hi Patrick,

I need to determine how this id/tid is generated first...

This is done by MySQL (→ AUTO_INCREMENT), so you can't determine it before inserting the entry. You can only determine it afterwards with LAST_INSERT_ID().

Alex

Automated Topic

by Patrick Riley, Tuesday, March 24, 2009, 22:05 (5509 days ago) @ Alex

I took your advice by inserting an entry without the id field, it was then auto assigned, and then I used the LAST_INSERT_ID() to update the record.

Have a good day and thanks for saving me a head ache!!!

-patrick :-)

RSS Feed of thread