Sigmahokies Posted June 4, 2018 Share Posted June 4, 2018 Hi everyone, I know how to create new table by PHP, but I don't know how to have relationship to prime table such as account or register table once a new table is insert. Can you please show me how to do that? I know how to create new table, but my point is once table is insert in phpmyadmin, then have relationship connect to prime table. If you are not sure, I will explain more about this. Thanks, Gary Link to comment Share on other sites More sharing options...
justsomeguy Posted June 4, 2018 Share Posted June 4, 2018 Assuming you're using InnoDB and MySQL, you add foreign key constraints either when you create the table, or later using an ALTER TABLE query. https://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html Link to comment Share on other sites More sharing options...
Sigmahokies Posted June 4, 2018 Author Share Posted June 4, 2018 Actually, I am using MySQL (MariaDB), All right I will try this, I will come back to comment if I have something wrong or question. Thanks, Gary Link to comment Share on other sites More sharing options...
justsomeguy Posted June 4, 2018 Share Posted June 4, 2018 I'm talking about the storage engine used for the tables. InnoDB supports foreign keys, MyISAM does not. Your MySQL tables are probably using one of them, only InnoDB will enforce those constraints. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now