Jump to content

Recommended Posts

Hi,

 

I have a problem and am trying to figure out the best way to solve it...

 

I have three tables

 

post

user_post

user

 

When a user creates a post I want to store this in the post and user post table. They have to be logged in to do so. The problem i have is inserting data into the user_post table I have a problem.

 

In order to write to the user_post table I need to have the userid and the postid. Getting the userid is not a problem as i already have this detail stored in the session. To get the post id ready to insert into the user_post table I have no 'full proof' way of doing so. As there is nothing unique in the post table apart from the post id which i am trying to access I have no way of querying it to get this result.

 

The only options that i can think of are:

 

 

select the max postid and take that assuming that this must be the one that the user has entered

 

OR

 

select the postid based on the post text and datetime stamp.

 

However if multiple users post at similar time with the same message etc this would become a problem#

 

Any suggestions would be much appreciated

 

Thanks

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.