Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Jul 2011
Offline Last Active Apr 04 2013 05:52 AM

Posts I've Made

In Topic: mysql database

27 December 2012 - 11:06 PM

i thought SELECTs were like looping through the entire database, well all your help should help me be on the way, now i suddendly dont feel stucked, and i can go on and keep working on my project, thanks a lot

In Topic: mysql database

27 December 2012 - 02:50 PM

just a quick example of what i need to be clear:


lets say i have these tables:



pk iduser





pk idroles




pk idpriv



alright so i have an user: iduser=0, name=test


i have roles: 0=admin, 1=moderator, 2=member, 3=guest


so i would have another table to state a relationship:



pk iduser_role

fk iduser

fk idroles


up until this point its pretty easy, each user will have one role, but then mr. priviledges joins the party.


we have these priviledges: 0=view, 1=post, 2=edit, 3=delete.


so now we need another relation table and this one is the one i dont quite understand, because using your method, i would have to do the following:



pk role_priviledge

fk idrole

fk idpriv


so if i want to give admins full rights, i would have to add 4 elements to that table, like



pk role_priviledge=0

fk idrole=0

fk idpriv=0

then one for fk idpriv=1, then one for 2 and one for 3.


this is the way that role_priviledge table would work, so if possible, i'd like it to work on a more efficient way, like admin has rights 0,1,2,3, all in one element.


the reason why i feel this is a need, is because if i had 100 roles, and 1000 priviledges, the role_priviledge table would be a hell to query and to understand.

In Topic: mysql database

27 December 2012 - 02:04 PM



for example


123, TYPE.RESTORE_HEALTH, 15 (over 15 seconds), PERCENTAGE, 15%


when you pool out effect, you simply check its TYPE, and then do needed stuff with VALUES.



Well, that's at least what i usually do.


oh i see now, so if i have multiple possible values, i dont have to have them one by one on the table, like poison and stuff, i just have them as values and use those values according to the type, very interesting.

In Topic: mysql database

27 December 2012 - 02:01 PM

im not quite sure, it just feels more efficient if u could virtually link a user with his own item table, instead of checking one by one every item the user has gotten on a database lots of users are going to use, lets say i have 1000 users and 1000 items, whenever i wanna see items for user 123, i would have to loop through the entire character_item table, to check for his CID, i am fairly new to the database subject but that just feels unefficient, i guess im just thinking like object oriented.

In Topic: mysql database

27 December 2012 - 05:21 AM

i have another question that i will also ask here because i think its related.



lets say i want something like an rpg, i have my user table with my user called 001, that user 001 has one item from the item table with the id of 123.



so 001 has one 123, somehow i have that on my database.


now lets say 123 is a potion that restores 100 life points to my user, how would i store this effect on the database? like how would it appear in the database that the item must restore 100 life points to the user?