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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
a4hiwayman
Forum Newbie
Posts: 1
Joined: Mon Sep 07, 2009 5:50 am

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

Post 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
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

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

Post 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.
Post Reply