I'm not sure if this goes to the coding forum or the sql forum so I stuck it here 😛
As I sayd i'm building a forum, well acctually i've already build one but as I look at my code to add some stuff I suddenly understand how un-effeciant my whole database structor/code is.
I have two tables, one for topics and one for posts. The topic table contains the topic name, text, maker, time made and id. The post table contains the post text, maker, time made, post id and topic id.
So I thought every thing would be so much easier if the post table would contain the topic text as a normal post and the topic table would only contain the title, maker, time and topic id.
I downloaded phpbb and ib (Ready forum applections), looked at the code and saw that they use the same db structor I have just thought of.
Now to the point, I can't figure how to do this. After the topic is sent I insert the data (title, maker and time made) to the topic table and it get an id. The message itself is sent to post table but it doesn't have a topic id (Or anything else to link it to the other data in the topic table) becuase it was just created. My question is, how does this work? How do I insert the topic id that was just created into the post table togther with the acctuall message?
Excuse my poor english :bemused: