when a user signs up to my site they complete a registration form and have their details put into a table called ptb_registrations.
after this they receive an email with a verification code, they click the email link and go to the verification link, upon entering the correct code i want a query to run.
this query needs to act as an insert query that will copy the data from one table (ptb_registrations) into another (ptb_users).
can someone help me with this as it's not working and im not sure if im heading in the right direction. thanks
// Make a safe query $query = sprintf("INSERT INTO ptb_users (first_name, last_name, email, password, dob) SELECT firstname, lastname, email, password dob WHERE not exists (select 1 from ptb_registrations where ptb_registrations.registration_code='$verificationcode';", mysql_real_escape_string($newpassword)); mysql_query($query)or die('Could not update members: ' . mysql_error());
passwordanddob, and a missing closing parenthesis for the WHERE's sub-select.Could not update members: some error hereWhat error is shown there? But as for me, your problem is that you have no comma between password and dob in select.