SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/12/2019, 04:37 PM   #11
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Fetch offline and online players

Quote:
Originally Posted by Kwarde View Post
@Calisthenics: Never been into foreign keys 'cuz when dropping all tables in a DB I'd have to uncheck 'check for foreign keys'. And I always forget that so I'd have to remove tables twice. (Lazyness level 1000...).
What's the benefit of using foreign?
@Joe staff: I don't mind you asking :P
Users table in this exampke would be the table containing the users on the server (so not persay directly connected to the faction system).
Then what remains is indeed the factions table and the table containing faction members.
Is it beneficial to have the user table not be connected to the faction system? Or is this just an assumption of a pre existing Table, so as to not require changes?
Joe Staff is offline   Reply With Quote
Old 03/12/2019, 04:48 PM   #12
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,703
Reputation: 1664
Default Re: Fetch offline and online players

It is an assumption of a pre existing table (same table used for checking if someone is registered on the server. Didnt include columns like password, adminlevel etc because that was not relevant here)
__________________
When the opportunity presents itself to flip-a da table, uh, you flip-a da table.

Discord: Kwarde#1966
Kwarde is online now   Reply With Quote
Old 03/12/2019, 06:08 PM   #13
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: Fetch offline and online players

Quote:
Originally Posted by Joe Staff View Post
If you don't mind me asking, why would he have 3 tables (factions, member/faction association, members) instead of just 2 tables (factions, members including faction Id)?
While it is possible, it makes things easier for future changes and also more organized.

- A faction can have ranks and each faction can have different ranks.
- A user can belong to more than 1 faction.
- Deleting a faction can delete any records associated in the child table faction_members otherwise you would have to set NULL on delete.

Quote:
Originally Posted by Kwarde View Post
What's the benefit of using foreign?
Data integrity.
Calisthenics is offline   Reply With Quote
Old 03/12/2019, 06:49 PM   #14
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,703
Reputation: 1664
Default Re: Fetch offline and online players

Nice clear answer, thanks

Edit:
I just realised that Owner in factions was not supposed to be a name but the user ID, lol
__________________
When the opportunity presents itself to flip-a da table, uh, you flip-a da table.

Discord: Kwarde#1966

Last edited by Kwarde; 04/12/2019 at 01:19 AM.
Kwarde is online now   Reply With Quote
Old 04/12/2019, 02:23 PM   #15
ImTobi
Big Clucker
 
ImTobi's Avatar
 
Join Date: Jun 2017
Posts: 144
Reputation: 3
Default Re: Fetch offline and online players

Thanks man! REP+ @Kwarde
ImTobi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Fetch offline player's data (MySQL R41-4) StevenLV Tutorials 6 01/10/2019 05:42 PM
ID 8 is offline but is actually online. WhateverRP Scripting Help 0 11/02/2017 04:22 PM
[PHP] Help Online and Offline Tween73 Scripting Help 4 14/03/2016 02:13 PM
Offline and Online Members ShoortyFl Scripting Help 20 26/06/2015 05:51 PM
Looping trough online AND OFFLINE players Kyance Scripting Help 4 17/03/2014 01:48 PM


All times are GMT. The time now is 02:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.