(((TOLK))) Posted February 7, 2009 Posted February 7, 2009 Can sum1 help me?? i need a hall of fame kind of code for referals so it shows who hav the most referals Quote
Magictallguy Posted February 8, 2009 Posted February 8, 2009 Re: Need an Mccodes hall of fame of referrals Is your refferal system using a separate table from users? If so, post the structure for your referals table. If not, tell us what the refferals field is named as. If you don't know how to do that Learn SQL NOW! ;) Use this SQL: DESCRIBE `refferals_table_name`; Quote
Eternal Posted February 8, 2009 Posted February 8, 2009 Re: Need an Mccodes hall of fame of referrals edit:for who ever match to your referral sql to this page. why learn when you get ..... on your case all the time??? echo '<table class="table" width="75%"> <tr style="background:brown"> <th>Name</th> <th>Referrals</th> </tr>'; $ar=$db->query("SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10"); while($s = $db->fetch_row($ar)) { echo '<tr style="background:brown">'; echo '<td>'.$s['refREFER'].'</td>'; echo '<td>'.$s['total'].'</td>'; echo '</tr>'; } echo '</table>'; *note i use a fotmatted name function so bringing their username here for me is useless... enjoy Quote
Neji_Hyuuga Posted February 11, 2009 Posted February 11, 2009 Re: Need an Mccodes hall of fame of referrals where in hall of fame do i add this code as i like the idea of this Quote
(((TOLK))) Posted February 17, 2009 Author Posted February 17, 2009 Re: Need an Mccodes hall of fame of referrals does any1 hav 1 were staff cant be on it Quote
Faz` Posted February 17, 2009 Posted February 17, 2009 Re: Need an Mccodes hall of fame of referrals You would have to edit staff level, what each number is I am not sure, you might have to search around here. Also, can't you try and do some yourself? I mean, I'm a noob yet even I know that, I am not being mean, just giving some advice. I'm sorry, I did not explain that properly $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY us.IQ DESC,u.userid ASC LIMIT 20"); u.user_level !=0 would have to be changed Quote
gurpreet Posted February 17, 2009 Posted February 17, 2009 Re: Need an Mccodes hall of fame of referrals QUERY ERROR: Invalid use of group function Query was SELECT COUNT('refREFED') AS total,refREFER FROM referals ORDER BY COUNT('referred') DESC LIMIT 10 I took out the group function but it's still using it, here's my query. $ar=$db->query("SELECT COUNT('refREFED') AS total,refREFER FROM referals ORDER BY COUNT('referred') DESC LIMIT 10"); while($s = $db->fetch_row($ar)) Can anyone put me in the right directon? Quote
(((TOLK))) Posted February 18, 2009 Author Posted February 18, 2009 Re: Need an Mccodes hall of fame of referrals Thanks guys You would have to edit staff level, what each number is I am not sure, you might have to search around here. Also, can't you try and do some yourself? I mean, I'm a noob yet even I know that, I am not being mean, just giving some advice. I'm sorry, I did not explain that properly $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY us.IQ DESC,u.userid ASC LIMIT 20"); u.user_level !=0 would have to be changed I don't find that mean at all, i appreciate ur comments Quote
(((TOLK))) Posted February 18, 2009 Author Posted February 18, 2009 Re: Need an Mccodes hall of fame of referrals I know u guys are gonna think i'm completely useless, and well... I am, i keep gettin this no matter what i try Fatal error: Call to a member function query() on a non-object in /home/talkeen/public_html/new.php on line 8 Quote
(((TOLK))) Posted February 18, 2009 Author Posted February 18, 2009 Re: Need an Mccodes hall of fame of referrals OK GUYS I'VE GOT IT (AT LAST) STICK THIS IN HALLOFFAME.PHP: function hof_referals() { global $db,$ir,$c,$userid, $myf; print "Showing the 6 users with the highest number of referals <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>User ID</th> <th>Number of referals</th> </tr>"; $p=0; $ar=$db->query("SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10"); while($s = $db->fetch_row($ar)) { echo '<tr style="background:brown">'; echo '<td>'.$s['refREFER'].'</td>'; echo '<td>'.$s['total'].'</td>'; echo '</tr>'; } print "</table>"; GOT SOME HELP FROM ETERNAL AND HAUNTED DAWG, GOT THEIR IDEAS ADDED SUM OF MINE AND TA-DA HERE U ARE!!! Quote
gurpreet Posted May 30, 2009 Posted May 30, 2009 Re: Need an Mccodes hall of fame of referrals OK GUYS I'VE GOT IT (AT LAST) STICK THIS IN HALLOFFAME.PHP: function hof_referals() { global $db,$ir,$c,$userid, $myf; print "Showing the 6 users with the highest number of referals <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>User ID</th> <th>Number of referals</th> </tr>"; $p=0; $ar=$db->query("SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10"); while($s = $db->fetch_row($ar)) { echo '<tr style="background:brown">'; echo '<td>'.$s['refREFER'].'</td>'; echo '<td>'.$s['total'].'</td>'; echo '</tr>'; } print "</table>"; GOT SOME HELP FROM ETERNAL AND HAUNTED DAWG, GOT THEIR IDEAS ADDED SUM OF MINE AND TA-DA HERE U ARE!!! Showing the 6 users with the highest number of referals QUERY ERROR: Invalid use of group function Query was SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10 Quote
(((TOLK))) Posted June 1, 2009 Author Posted June 1, 2009 Re: Need an Mccodes hall of fame of referrals I didn't add the cases and stuff, view this post and Neji Hyuuga has posted it fully http://criminalexistence.com/ceforums/h ... 60#p133360 Quote
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.