vendredi 26 juin 2015

Is there an "ON CREATE" foreign key constraint?

I am just getting started with SQLite and SQL in general. I am using a PHP script to facilitate a secure login process. This script uses an SQLite database with a table users containing user id (primary key) username, email and password hash. I want to store additional information on users (e.g. name), but I don't want to touch the table the script uses, so I'm trying to add another table users_info with a foreign key referencing the user id of the users table. This takes care of deleting a user from the users_info table whenever I delete a user from the login script's users table, but I also want a new row (with the correct user id) to be created in users_info whenever I register a new user to the users table.

Is this possible?

Aucun commentaire:

Enregistrer un commentaire