Jump to content

Donators *


Gubbins

Recommended Posts

I am trying to put a star alongside the players who have donated, when i add this:-

if ($don = "1"){ echo "<font color=gold>*</font>"; } echo "$playername";
$don = mysql_query("SELECT * FROM `players` WHERE `donator` = '$user' LIMIT 1")or die(mysql_error());
$dnum = mysql_numrows($don);

 

I get all the players online with a star next to there name, in the database i have:-

donator  enum('0','1') default being `0`

 

can anyone see my problem please.

 

Regards

 

Gubbins

Link to comment
https://forums.phpfreaks.com/topic/187556-donators/
Share on other sites

order of your code. Try

 

$don = mysql_query("SELECT * FROM `players` WHERE `user` = '$user' LIMIT 1")or die(mysql_error());
$dnum = mysql_numrows($don);
$don=mysql_result($don,0,"donator");
if ($don = "1"){ echo "<font color=gold>*</font>"; } echo "$playername";

 

Also change `user` to whatever you have for user name and the way you were saying i think you had donator in table as either 1 or 0? this means `donator` would never be $user

Link to comment
https://forums.phpfreaks.com/topic/187556-donators/#findComment-990232
Share on other sites

order of your code. Try

 

$don = mysql_query("SELECT * FROM `players` WHERE `user` = '$user' LIMIT 1")or die(mysql_error());
$dnum = mysql_numrows($don);
$don=mysql_result($don,0,"donator");
if ($don = "1"){ echo "<font color=gold>*</font>"; } echo "$playername";

 

Also change `user` to whatever you have for user name and the way you were saying i think you had donator in table as either 1 or 0? this means `donator` would never be $user

 

 

Thank you,

I changed `user` to playername which is what we use and i still get all players online with a star next to there name.

I am sure its almost there....

Link to comment
https://forums.phpfreaks.com/topic/187556-donators/#findComment-990238
Share on other sites

@Rayth can't believe you missed this:

 

if ($don = "1") // should be == or ===

 

Instead of making it so hard to add something so futile do this:

 

echo $don == 1 ? "<span class=\"donator\">$playername</span>" : $playername;

 

Then using simple CSS:

 

.donator:after { content: " *"; color: #0EE; }

Link to comment
https://forums.phpfreaks.com/topic/187556-donators/#findComment-990249
Share on other sites

@Rayth can't believe you missed this:

 

if ($don = "1") // should be == or ===

 

Instead of making it so hard to add something so futile do this:

 

echo $don == 1 ? "<span class=\"donator\">$playername</span>" : $playername;

 

Then using simple CSS:

 

.donator:after { content: " *"; color: #0EE; }

 

Wow thank you very much it worked a treat :)

It always shocks me how one simple command makes such a difference.

Thanks again..

Link to comment
https://forums.phpfreaks.com/topic/187556-donators/#findComment-990252
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.