Hi there.

Okay heres the scenario. I have 2 tables "Logins" and "User_Details"
What I want to do is write a PHP query that whenever a new user is created, that is manually entered into "User_details" table using a form, the next thing that should happen is that it should copy the value of the first 2 attributes from user_details table which are user_id and password into "Logins" table having the same 2 attributes only.

So what is the correct PHP query code for this. I tried many things but failed. I need somebody whos good at php / mysql to help me out! :)

Thanks!

I have everything setup. I just need the codes that do the copying. Assuming that the values entered are stored like this:

$values["user_id"]
$values["password"]

Attribute user_id is a primary key.

--
-- Table structure for table `logins`
--

CREATE TABLE `logins` (
  `id` varchar(50) NOT NULL default '',
  `password` varchar(50) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `user_id` varchar(50) NOT NULL default '',
  `password` varchar(50) default NULL,
  `full_name` varchar(50) default NULL,
  `nationality` varchar(50) default NULL,
  `govt_id` int(11) default NULL,
  `email` varchar(50) default NULL,
  `traffic_status` varchar(50) default NULL,
  `traffic_points` int(11) default NULL,
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.