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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-22-2022, 03:33 AM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 770
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
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2022, 07:14 AM   #2
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
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.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2022, 09:48 AM   #3
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 770
Quote:
Originally Posted by redwhiteandblue View Post
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.
Cheers, much appreciated
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
documents, union, pull, user, tables, creating, feedback, fields, array, page, tia, admin, information, hidden, form, database, sql, called, field, automatically, tagged, table, system, writers, submit



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.