Retrieving Information From 2 Database Tables

Discussion in 'PHP' started by Alley Cat, Jun 10, 2007.

  1. #1
    I have 2 tables in a database, in one I have information from a registration form, and in another I store filenames of images uploaded, and I want to retrieve information from both of these tables into 1 table on a web page, how can I achieve this? Both tables have email addresses in them so would it be possible to align information using these?
     
    Alley Cat, Jun 10, 2007 IP
  2. mrmonster

    mrmonster Active Member

    Messages:
    374
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #2
    This is an SQL question, but here is a simple query that should get you going. It will select all records from table_A and attempt to join with records from table_B if they have matching email_field.

    SELECT * FROM table_A LEFT JOIN table_B USING(email_field);
     
    mrmonster, Jun 10, 2007 IP