Jump to content
MakeWebGames

Recommended Posts

Posted

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`;
Posted

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

Posted

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

Posted

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?

Posted

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

Posted

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

Posted

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!!!

  • 3 months later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...