crashmaster Posted January 3, 2008 Share Posted January 3, 2008 Hi there, and one more question. user system. Database: user_id (auto_incr) , position When user register his profiles => in database inserting the same values for position as for user_id When somebody search user => script show profiles ORDER BY position DESC If somebody want to "go up" he could pay, and then his position will be : MAX(position) + 1 How can I earn from database actual user position.. ?? I can do it with : $q = mysql_query("SELECT * FROM user ORDER BY position DESC"); $i = 0; while ( $z = mysql_fetch_array($q) ) { if ($_SESSION['user_id'] == $z['user_id']) { echo 'MY POSITION IS:' . $i ; } $i++; } But I think it will kill my database when about 20 000 users will be online, and total user count will be bout 100 000 .... Does anyone have any idea for a "lighter" script ??? Quote Link to comment https://forums.phpfreaks.com/topic/84350-user-position/ Share on other sites More sharing options...
cooldude832 Posted January 3, 2008 Share Posted January 3, 2008 do not alter your primary key of your data base it is there for 3 reasons 1) Continuity of the data 2) Unquietness of the table 3) Cross linking tables. You need to put a new column in there for "ranking" Quote Link to comment https://forums.phpfreaks.com/topic/84350-user-position/#findComment-429629 Share on other sites More sharing options...
crashmaster Posted January 3, 2008 Author Share Posted January 3, 2008 sry. but I dont understand... DON TO ALTER .. .what does it mean ??)) sry for my poor english ) Quote Link to comment https://forums.phpfreaks.com/topic/84350-user-position/#findComment-429638 Share on other sites More sharing options...
cooldude832 Posted January 3, 2008 Share Posted January 3, 2008 it means don't change the primary key of the database Quote Link to comment https://forums.phpfreaks.com/topic/84350-user-position/#findComment-429648 Share on other sites More sharing options...
crashmaster Posted January 3, 2008 Author Share Posted January 3, 2008 primary key is also USER_ID column Quote Link to comment https://forums.phpfreaks.com/topic/84350-user-position/#findComment-429656 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.