1 - have an SQL table that holds a list of books. The index is the ISBN. (the shared foreign key)
2 - I have another SQL table that holds the details of the book, that also has the ISBN is the foreign key.
When the user searches the Books, I want a table of books (1). However when the user clicks on the more. button (I have Master Detail Tables) how do I get the page to show the details. from the. book details (2) rather than then list of books? (1)
I have seen the material in relation to foreign keys but would like an explanation of how I would get the MDT to read the second database and not the first.
The 1st table should be used as the source, so the second table pulls the data from the first table based on an ID.
For example, the 1st table has an ID column that stores unique IDs for books, and that column should be used as the "Store value" when you're configuring the Foreign Key in the 2nd table. The 2nd column in the 1st table should be the Title column, where titles of the books will be added. This column should be added as the "Display value" in the 2nd table.
The column in the 2nd table needs to be an integer column, so the ID from the 1st table is recognized in the 2nd table. Also, the column names from these two tables should not be the same, otherwise, it may not work correctly.
Hi,
1 - have an SQL table that holds a list of books. The index is the ISBN. (the shared foreign key)
2 - I have another SQL table that holds the details of the book, that also has the ISBN is the foreign key.
When the user searches the Books, I want a table of books (1). However when the user clicks on the more. button (I have Master Detail Tables) how do I get the page to show the details. from the. book details (2) rather than then list of books? (1)
I have seen the material in relation to foreign keys but would like an explanation of how I would get the MDT to read the second database and not the first.
Thanks
M
Hello Michael
The 1st table should be used as the source, so the second table pulls the data from the first table based on an ID.
For example, the 1st table has an ID column that stores unique IDs for books, and that column should be used as the "Store value" when you're configuring the Foreign Key in the 2nd table. The 2nd column in the 1st table should be the Title column, where titles of the books will be added. This column should be added as the "Display value" in the 2nd table.
The column in the 2nd table needs to be an integer column, so the ID from the 1st table is recognized in the 2nd table. Also, the column names from these two tables should not be the same, otherwise, it may not work correctly.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables