Copying data into another table?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Copying data into another table?

Post by cturner »

Can someone please tell me how I can copy one item in one row into another table? I am wanting to do the above when a comment is being added to the second table. I am wanting to copy userid in the users table into the commentpost table. Thanks in advance.

My tables are like this:
Article (Articleid, selectDay, selectMonth, selectYear, article_item)
Users (Userid, username, password, email, ip)
Commentpost (Articleid, userid, comments, date_entered)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You should have the user id prior to the insertion under most common circumstances. :?
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Post by cturner »

feyd wrote:You should have the user id prior to the insertion under most common circumstances. :?
Not in this case. Are you going to show me what I have asked or not?

Is this suppose to be posted in the PHP forum. If so can someone please move it there?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Perform a select to pull out the user id then.
Post Reply