Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
11-22-2022, 03:33 AM | #1 |
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 762
|
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 |
11-22-2022, 07:14 AM | #2 |
Bollocks
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
|
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.
__________________
Interserver unmanaged AMD Ryzen servers from $73.00 |
11-22-2022, 09:48 AM | #3 | |
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 762
|
Quote:
|
|