Quote:
Originally Posted by Fou-Lu
If I follow this correctly, you want to simply use a foreign key constraint. The key relation will require a record in one table that already has a corresponding key in the second. So this second table would insert all the valid records, then the key relation is placed on the first table, and you simply attempt to insert. If it provides no affected rows after the insert, it will trigger an error indicating a key violation, which is simply the answer for no valid foreign key constraint was satisfied.
If you don't need to store input, than a simple select would tell you if it already exists. It's not clear how you are intending to use the existing disc_id.gamecode in relation to the gamecode via input.
|
If the gamecode comes back as existing in the database, I'd like the form to submit correctly. If it returns as non existent, then I'd like the form to not be submit, so I can give the user the option to email their submission for confirmation. They are entering product IDs (gamecode), so I've compiled a list of basically every possible product ID they can use.
edit: If a foreign key constraint is used here, when disc_id inserts it's gamecode column data to the first table, if the tables are not duplicates of each other how does it make this match? does it use the input fields value after the form is POSTd to do this? Just wondering how it works.