MySQL Forums
Forum List  »  Synchronization

Re: Syncing data between 2 tables of the same database
Posted by: Peter Brawley
Date: May 01, 2018 04:07PM

> clicking the SIGNUP button, I need the above mentioned field data
> passed to the Wordpress wp_users table and columns

Before you write the SQL, you need to specify more logic, eg if there is a wp_users row with the same wp_user column value, update the row destroying the old data, flag the situation as a problem to be resolved manually, skip the row, or what? OTOH if there is no such row, then you'll need to study the wp database & source code to find the validation rules for each column on insert.

Supposing the answer is to overwrite and there are no rules other than do not duplicate the wp_user column, then if the wp_user value exists you could just add this query to what the form is doing

update wp_users
set wp_password='...',wp_email='...'
where wp_user='...';

substituting the dots with form values, and if the form user value does not exist in wp_users, then insert a new row into wp_users.

You've not said if the table for which the form is designed is in the wp db. If not, you'll need to qualify wp_users table references with the wp db name.

Options: ReplyQuote

Written By
Re: Syncing data between 2 tables of the same database
May 01, 2018 04:07PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.