php mysql code to update one table with values of another?

Question by Yasin Hossain: php mysql code to update one table with values of another?
I have two identical tables with the same fields and datatype. Lets call the first one temp and the other final. I am trying to run a php script that will update my final table with values from my temp table.

I am new in php mysql and would appreciate your help.

regards

Best answer:

Answer by Chris S
in ya php just insert to both tables at once

for example say if you are creating a social network site in php

when a user is registered in ya php u need to get his id and put it to other tables that need his id to work like a table for comments. a table for his profile picture.

so registers php u put his user name and password up to members table u then query the members table for his member id (the auto incrementing id) and u then save his member id to a variable and insert that variable to the comments table and the profile picture table so its ready for later when u create them features. this all happens in the register part.

What do you think? Answer below!

Revisions

There are no revisions for this post.

Tags: , , , , ,

One Response to “php mysql code to update one table with values of another?”

  1. just "JR" October 19, 2011 at 7:33 AM #

    Wrong approach!
    Just use one table.
    Add one field: “confirmed”, boolean
    When you first insert, it is “temporary”: set “confirmed” = 0 (false).
    When it is confirmed, set “confirmed” = 1 (true).

Leave a Reply