Page 1 of 1

Posting/reading to/from multiple tables using a single form

Posted: Mon Sep 07, 2009 5:54 am
by a4hiwayman
Hi, a newbie to the forum and PHP coding.
I have two applications on one site that use PHP and MySql, one a bulletinboard and one a gallery. Both have separate login pages and registration forms. I am looking to use a single, more comprehensive registration form and a single login for both applications. So visitors only have to register and/or login on the site once.

I have imported the tables from the one database in to the other so I now have a single database with multiple registration tables.
Unfortunately the tables have different names:

Table1 (Members)
password
*no entry*
email
added
status
displayname

Table2 (users)
user_password
user_nicename
user_email
user_registered
user_status
user_displayname

Would I be better off using the 'JOIN' (or similar) statement to link the tables or would the easier approach be to use PHP? within the form to post a single entry to the relevant fields in the two tables? I have also heard of something called 'switch'.

I am looking for any advice that would point me in the right direction as to the best method

Many thanks for your help in advance.
Gavin

Re: Posting/reading to/from multiple tables using a single f

Posted: Thu Sep 10, 2009 11:38 am
by McInfo
Overview:
  • Clean up the database so you have only one table to work with.
  • Update the queries in your PHP applications to reference the correct field names in the new table.
To limit disruption of service to your users, the process might be:
  • Create backups of your database and PHP applications.
  • Create a new database table.
  • Modify copies of the PHP applications to work with the new table.
  • Copy the existing user data to the new table.
  • Deploy the modified PHP applications.
  • Confirm that the new user table is up-to-date.
  • Drop the two old user tables.
Edit: This post was recovered from search engine cache.