SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Help with foreign keys

    Hi,

    I'm designing a website where a user can post properties to rent, this is what i am trying to do:

    The logged on user enters in fields such as 'Property Type', 'Address', 'Rent' etc.

    When the user submits this form these values are entered into the Property Table and the next page displays these values - I can do all this no problem.

    However I would like to use the User ID - How do I register the User ID as a foreign key in the Property Table.

  2. #2
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Philippines
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I assume you're using MySQL, just add a field with similar datatype as the User ID. Just include it in your insert query. Of course, you have to have a way to get the value somewhere...say a hidden input field in the form or from the session, whatever works for you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •