SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2001
    Location
    BC, Canada
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Foreign Key Constraints in Mysql

    I have created a table in mysql with references to other tables as foreign key constraints. For example order has a foreign key constraint to customer so that I can't enter a new order for a customer unless the customer is in the customer table. But it doesn't seem to work and I can enter any customer regardless of whether they are in the customer table.

    I checked the mysql documentation and for what I understand it isn't supported. Is there anything I can do to enforce key constraints?

  2. #2
    SitePoint Member
    Join Date
    May 2001
    Location
    BC, Canada
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Damn

    Well I've searched the forums and I guess my only solution is to code the constraints into php. Damn that is really unfortunate.

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, you will have to, for example, check if your customer has a valid id before you can create an order on the id

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


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
  •