![]() |
Whats this called?
I have two tables in the same SQL database that I want to pull information from (and have a user id in a hidden form field) so that when my writers submit documents through my admin system, it gets automatically tagged in the documents table with their user id.
Would that be creating a 'union' or is it something else? Database Name Table 1 - User Registration - I want to pull registered user ID from here. Table 2 - Document Uploads - And attach it to the form upload when this is submitted. Also, if it is a union, am I able to put an array on a page that will pull fields from both tables or just one? TIA for any feedback :) |
No it's not a union.
You need to decide the relationship between the two tables. If only one user can ever be the author of a document, you just need a column in the document table containing the user id of that user. If more than one user can contribute to a document you need a relational table. This would be another table with two columns, one for the document id and another for the user id. You add a row in this table for each user who contributed to each document. This allows you to have as many relationships between users and documents as necessary. You then pull out the data with two joins statements in your query. |
Quote:
|
All times are GMT -7. The time now is 06:15 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc