thisisnuts123 Posted November 5, 2007 Share Posted November 5, 2007 hello guys, I was wondering if this is posible, if so do u guys have good article i can read? i have a user table and i have a main table. every time a user signs registers it will create information in the user table so for every user there is a new entry ( no problem here) now when the user logs on to the site it will take information from the main table and randomzie it.. so the information will be changed every time a user refreshes the game.. the prblem is if 2 users are logged on at the same time.. and are accessing the same table.. this will effect how the game works. is there a way work around this? so when the information is changed it does not effect every one and only that one user. so 2 or more users can use the same database Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/ Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 any ideas? does it have something to do with locking tables? or the way they are linked? Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384779 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 can temporary virtual tables be created? Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384803 Share on other sites More sharing options...
PHP_PhREEEk Posted November 5, 2007 Share Posted November 5, 2007 Add a UserID reference to the main table. As you have it now, I would guess the main table only has one record in it with fields and attributes? For what I suggest, now you will create multiple records, all associated with a UserID. Then, only that User's record in the main table is randomized or changed, and it stays undisturbed until they login again. PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384807 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 so currently i have a user table which has normal stuff user id/name .password etc etc.. so for eatch user has it;s own record then i have the main table which is has: | item | order | itemnum | dat this table has 16 records.. so when the user logs in and clicks start it will randomize all the information so lets say item 1 = hello item 2 = hi item 3 = whatsup it will make item 1 = whats up 2 = hello etc etc.. now when the 2nd user logs on.. and cliks starts it;s gona again ramize every thing.. which will now effect the first user.. can this be solve with the way u discribed above? Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384818 Share on other sites More sharing options...
PHP_PhREEEk Posted November 5, 2007 Share Posted November 5, 2007 Please use MySQL or phpMyAdmin to post the structure of BOTH tables, then we can be more specific with advice. PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384822 Share on other sites More sharing options...
Zane Posted November 5, 2007 Share Posted November 5, 2007 I'm not really understanding your question entirely. but if you're wondering if randomizing the items for user1 will affect user2, it won't because you are required to have a primary key for every table you have. the only thing the you are randomizing is the order......I'm assuming Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384824 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 here is the Main table's structure: Field Type set varchar(50) item varchar(50) order int(9) itemnum int(9) dat varchar(99) so it looks like this set | item | order | itemnum | dat right one 5 1 test1 left two 4 2 test12 center three 3 3 test3 ... ... .., all the way till 16 -------------------------------- user table: Field Type id int(11) username varchar(64) password varchar(32) email varchar(228) ip varchar(32) fname varchar(32) lname varchar(32) country varchar(32) city varchar(32) gender varchar(32) bday varchar(40) date varchar(32) Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384832 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 so in the above whats happning is.. every time user hits start.. it will randome the order of these items.. so they are displayed diffrently each time Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384833 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 PRIMARY key = id in the user table and in the main table "item " is the primary key Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384836 Share on other sites More sharing options...
Zane Posted November 5, 2007 Share Posted November 5, 2007 http://sheeri.net/archives/117 If there is no primary key specified, the internal engine makes one anyway http://mysql.mirrors-r-us.net/doc/refman/5.1/en/mysql-cluster-limitations.html Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384840 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 hmm.. another way i can think of is.. every time a user sings up i can create a table $userid_table and then insert all the information since the info is always thee same when the user first starts.. but then my db is gona get full with too many tables.. or temp table create a table and then drop it when user logs of.. but problem with that is what if they dunt logoff and just close the bowser.. then i will have 2 many tables with no use. Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384850 Share on other sites More sharing options...
redarrow Posted November 5, 2007 Share Posted November 5, 2007 sorry copy all the info to the correct fields each time a user logs in then when next user that logs in tell the database to delete all entrys except theres ........... Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384854 Share on other sites More sharing options...
Zane Posted November 5, 2007 Share Posted November 5, 2007 There is no problem in having 2 or more users use the same table ... let only the same record. How do you think all these marketing sites work. Amazon, Tigerdirect, IMDB. All of their databases are being hit at the same time....most likely 100+ of the same records are being hit at the same time. Creating a new table for every user is a common idea a lot people think of. It never works out.just to warn you. Unless you have a lot of server money to throw around. You'll be fine in randomizing the order Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384855 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 ok so lets say right now no one is logged in and the table displayes so it looks like this set | item | order | itemnum | dat right one 5 1 test1 left two 4 2 test12 center three 3 3 test3 ------------ now the first user logs in and starts... the able will get ranmized so if i logon to my sql database i will see new info so the table becomes so it looks like this set | item | order | itemnum | dat right one 4 1 test1 left two 3 2 test12 center three 5 3 test3 ----------------------- so the first user is working with this.. now while the first user is working the 2nd user logs on.. and clicks starts now the table will again recorganize it self to another order. while this is happnong the first user refreshes the page.. now will his order change to new order or stay the same i am not sure how exactly mysql does this. but my belive is the first users order will be changed to new order.. and then 3rd user logs on and order again will be changed etc etc.. Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384861 Share on other sites More sharing options...
redarrow Posted November 5, 2007 Share Posted November 5, 2007 that why you was told this Add a UserID reference to the main table. As you have it now, I would guess the main table only has one record in it with fields and attributes? For what I suggest, now you will create multiple records, all associated with a UserID. Then, only that User's record in the main table is randomized or changed, and it stays undisturbed until they login again. PhREEEk each user needs to have there own id.......... Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384865 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 oh ok i was wondering if that would work with one record only since i have multiple records. any idea how i can create the refrence? Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384867 Share on other sites More sharing options...
Zane Posted November 5, 2007 Share Posted November 5, 2007 well you're right in one sense if you set it to order by random for user1 and he refreshes....yes he'll have a new order but user2 logging in won't affect user1, because he's on a different IP you may have to organize all of userX's data into an array and just use that EDIT: nevermind...I was too late in posting....guess I missed the point somewhere Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384879 Share on other sites More sharing options...
thisisnuts123 Posted November 5, 2007 Author Share Posted November 5, 2007 ok that makes sense to use an array thanks guys for your help Quote Link to comment https://forums.phpfreaks.com/topic/76016-solved-php-logon-mysql-database-help/#findComment-384880 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.