Colorful Users Nicknames

Started on the old forum in August 2007 · view the original in the archive · old links redirect here

74 replies · 5,614 views · started 19 years ago · 1 min read

TL;DR · summary of 74 replies
  • alesh needs help implementing code that allows users to choose their own nickname colors, but is having trouble with the database setup.
  • The thread suggests creating a new row in the users table for storing the color preference, but alesh is unsure if this is correct and how to implement it properly.
  • The issue of changing all nicknames to one color instead of individual user preferences remains unresolved.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

14 participants
blackhowk Senior · 411 posts #21

pls sum1 tell me whts wrong here?

try this or like this

$select_db = mysql_select_db($db); if (!$select_db) { echo " No DB " .mysql_error(); } $sql = "SELECT color, USER FROM sw_users WHERE id='".$uid."' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $color = $row['color'];

echo ""; echo "USER"; echo "";

color varchar(7) NOT NULL default '#D8D5D5',

alesh Lead · 604 posts #22

try this or like this $select_db = mysql_select_db($db); if (!$select_db) { echo " No DB " .mysql_error(); } $sql = "SELECT color, USER FROM sw_users WHERE id='".$uid."' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $color = $row['color']; echo ""; echo "USER"; echo "";

color varchar(7) NOT NULL default '#D8D5D5',

hi... thanx... but i get this error

No DB No database selected Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/blabla/public_html/xhtml/inbox.php on line 223

on line 223 is this $row = mysql_fetch_array($result); from ur code....

i did play a lil bit and i get tht runing but again it change all the nicknames into jist 1 color even when i change color at my id!!!!! why??

maybe i wasnt explained it clearly.... I want tht users cn change a color just 4 their nickname only! 4 e.g. i want my nickname in red color and i choose the red and just mine nickname then its the red color....all other it should be the color they chooze 4 them self....

u understand my dificult problem now lol

eeeeerrr....

blackhowk Senior · 411 posts #23

your nick in red, others in personal colors.

like this, but you need to edit,

if ($uid = "ADMIN"){ echo "ADMIN"; } else{ echo [$color_from_database] NORMAL USER [$color_from_database]}

this show red for you and other user color for each member.

alesh Lead · 604 posts #24

your nick in red, others in personal colors.

like this, but you need to edit,

if ($uid = "ADMIN"){ echo "ADMIN"; } else{ echo [$color_from_database] NORMAL USER [$color_from_database]}

this show red for you and other user color for each member.

ughhh this starts 2 b complicated... lol

i dnt wanna b forced as an admin 2 have tht perticular color... i just wanna make tht evry1 cn chose their own fav color....

4 e.g. i made tht row in users table color varchar(7) NOT NULL default '#0000FF',

and i change at my ID tht my nick would b #FF0000

then i put ur code at the main page in inbox like this

$select_db = mysql_select_db($db);
if (!$select_db) 
{
echo " No DB " .mysql_error();
}
$sql = "SELECT `color`, `USER` FROM `sw_users` WHERE id='".$uid."' ";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$color = $row['color'];

$lnk = "<a href=\"inbox.php?action=readpm&pmid=$item[1]&sid=$sid\">$iml <font color=\"$color\">$item[0]</font></a>";
          echo "$lnk
";

but it gives me No DB no database selected ERROR...

then i removed tht db part and more and i get nicknames into other color but not just mine BUT ALL OF THEM..

where i making a mistake???

i want it like this: user register at site, he enter and his nick default color is 4 e.g. blue! then tht user goes 2 c panel and at option change ur color of nickname he chose the color only 4 his nickname,.... so when he save settings we all c his nickname in color he chosed!!!!

i knw how 2 make tht <select> part but not the rest

eeeeerrr....

hardrave #25

ughhh this starts 2 b complicated... lol

i dnt wanna b forced as an admin 2 have tht perticular color... i just wanna make tht evry1 cn chose their own fav color....

4 e.g. i made tht row in users table color varchar(7) NOT NULL default '#0000FF',

and i change at my ID tht my nick would b #FF0000 then i put ur code at the main page in inbox like this

$select_db = mysql_select_db($db);
if (!$select_db) 
{
echo " No DB " .mysql_error();
}
$sql = "SELECT `color`, `USER` FROM `sw_users` WHERE id='".$uid."' ";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$color = $row['color'];
$lnk = "<a href=\"inbox.php?action=readpm&pmid=$item[1]&sid=$sid\">$iml <font color=\"$color\">$item[0]</font></a>";
          echo "$lnk
";

but it gives me No DB no database selected ERROR...

then i removed tht db part and more and i get nicknames into other color but not just mine BUT ALL OF THEM..

where i making a mistake???

i want it like this: user register at site, he enter and his nick default color is 4 e.g. blue! then tht user goes 2 c panel and at option change ur color of nickname he chose the color only 4 his nickname,.... so when he save settings we all c his nickname in color he chosed!!!!

i knw how 2 make tht <select> part but not the rest

or try this my friends lse i

//////ALL LISTS SCRIPT <<

if($page=="" || $page<=0)$page=1;
$num_items = getnumonline(); //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;

//changable sql
$sql = "SELECT
        a.name,a.perm, b.place, b.userid FROM ibwf_users a
        INNER JOIN ibwf_online b ON a.id = b.userid
        GROUP BY 1,2
        LIMIT $limit_start, $items_per_page
";

echo " "; $items = mysql_query($sql); echo mysql_error(); while ($item = mysql_fetch_array($items)) { if($item[1]=='0') { $tit = ""; }if($item[1]=='1') { $tit = "[M]"; }if($item[1]=='2') { $tit = "[A]"; } if($item[1]=='3') { $tit = "****"; } if($item[1]=='4') { $tit = "[O]"; }

$sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'")); if($sex[0]=="M"){$usersex = "<img src="../images/male.gif" alt="(M)"/>";} if($sex[0]=="F"){$usersex = "<img src="../images/female.gif" alt="(F)"/>";} if($sex[0]==""){$usersex = "";} if($item[1]>'0') {

$lnk = "$usersex<a href="index.php?action=viewuser&who=$item[3]&sid=$sid">$item[0]$tit</a>"; }else{ $lnk = "$usersex<a href="index.php?action=viewuser&who=$item[3]&sid=$sid">$item[0]$tit</a>"; } echo "$lnk $item[2] "; } echo " "; echo " "; if($page>1) { $ppage = $page-1; echo "<a href="index.php?action=online&page=$ppage&sid=$sid">«Prev</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href="index.php?action=online&page=$npage&sid=$sid">Next»</a>"; } echo " $page/$num_pages"; if($num_pages>2) { echo getjumper($action, $sid,"index"); } echo " ";

blackhowk Senior · 411 posts #26

m8, the first and second code was for example! USER dont exist! YOU MAY NEED DO FIND one variable for your $USER, you may need to conect do DB if you are not connected..bla bla, blackberry; like a windfall.......and i dont know what script u use.im nervous.lol you dont know basic ruls on php.

Guest #28

it should men just work your way thru it but backup b4 you start

hardrave #29

the code are not complete its a sample

alesh Lead · 604 posts #30

m8, the first and second code was for example! USER dont exist! YOU MAY NEED DO FIND one variable for your $USER, you may need to conect do DB if you are not connected..bla bla, blackberry; like a windfall.......and i dont know what script u use.im nervous.lol you dont know basic ruls on php.

lol yes i knw just a basic lolololol and i did conect db .... i said i did lil modified tht code u gave and i get the color from the db but i always get just 1 color 4 all users grrrrrrrrrrr.... tht why i seek 4 help lol and dnt b nervous lol im using mix of lava-funmobile-mine script lol.........

@hardrave tht is even moreeeeeeeee complicated loland i dnt understand a thing lol

eeeeerrr....

alesh Lead · 604 posts #32

at the end of this topic i cn only say tht blackhawk was apsolutely right.....lol

it was actualy easy...only hard thng was modifing all the links where i wanted the colorful nickname 2 show (all script ) lol after i done tht i just made a page where user choose the color he/she want and thts it

when user choose the fav color, 4 example RED, evry1 see his/her nickname as RED link

lol

now evry1 cn change the color of their nicknames evry day lolololololololool

eeeeerrr....

alexism Developer · 136 posts #33

i dont understand the discussion in this topic...can someone give a conclusion n give me the script of color nick?

alesh Lead · 604 posts #34

Theres no script 4 colorful nicknames...lol Read this topic nd read blackhawks posts... Ull figure it out

eeeeerrr....

SiLeNce Developer · 138 posts #36

lolx !!

tOO eaSy maKing tHe coLor ..

noT uSe css ..

only

example

echo "<a href="index.php?action=viewuser&ses=$ses&who=$who">$whonick Profile</a> ";

easy to coding External image (may be gone) ...

alesh Lead · 604 posts #37

Well its not tht easy as u said.... Tht will show the color tht u wanna c,but not the color tht user chosen...

eeeeerrr....

alexism Developer · 136 posts #38

so i hope u cant post the coding for color nick here..

alesh Lead · 604 posts #39

I cnt do it from my head,cuz im not at home next 2 comp... Im still celebrating valentines day with my gf lol... when i get chance ill post example ok..?

eeeeerrr....

Guest #40

Prevedi na naski sta ti tacno treba?

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close