seany123 Posted March 31, 2009 Share Posted March 31, 2009 what im wanting to do is allow the people on my website to have a different color name.. to do this im using 3 different value in my mysql database in the members tables... (staff, rm and ncolor) staff = the color that staff have. rm = the color that respected members have. ncolor = the color that a member can pick out of a small selection. my problem is if a member is say a staff AND a respected member.. how do i choose which work out which color their username will be... so far i have this code... <? if($profile['Ncolor'] == 1) { echo "<font color=\"blue\">".$profile['username']."</font>"; } else if($profile['color'] == 2) { echo "<font color=\"green\">".$profile['username']."</font>"; } else if($profile['ncolor'] == 3) { echo "<font color=\"yellow\">".$profile['username']."</font>"; } else if($profile['ncolor'] == 4) { echo "<font color=\"pink\">".$profile['username']."</font>"; } else if($profile['ncolor'] == 5) { echo "<font color=\"silver\">".$profile['username']."</font>"; } else if($profile['staff'] >= 1) { echo "<font color=\"gold\">".$profile['username']."</font>"; } else if($profile['rm'] >= 1) { echo "<font color=\"orange\">".$profile['username']."</font>"; } ?> now my profile has qualifies for the staff color, rm color and #1 ncolor... so to my mine it should give me a orange name because thats the last else if that is to do with me... however i get a gold name... can anyone help me here? Quote Link to comment Share on other sites More sharing options...
seany123 Posted March 31, 2009 Author Share Posted March 31, 2009 ah i didnt put `ncolor` in to be retrieved from my database.. so now my name is displayed in blue... which is the opporsite way to which i thought it worked.. but nevermind it seems to have done the job. Quote Link to comment Share on other sites More sharing options...
Maq Posted March 31, 2009 Share Posted March 31, 2009 ah i didnt put `ncolor` in to be retrieved from my database.. so now my name is displayed in blue... which is the opporsite way to which i thought it worked.. but nevermind it seems to have done the job. I'm confused, is this solved? If so, please mark as [sOLVED], thanks. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted March 31, 2009 Share Posted March 31, 2009 instead of using so many if statements, why not just store the color itself in the database and output it in a $_SESSION['color'] and have just one statement: <?php if($profile['Ncolor'] == 1) { ?> <font color="<?php echo $_SESSION['color']; ?>"><?php echo $profile['username']; ?></font> <?php } Quote Link to comment Share on other sites More sharing options...
seany123 Posted April 1, 2009 Author Share Posted April 1, 2009 i i gue instead of using so many if statements, why not just store the color itself in the database and output it in a $_SESSION['color'] and have just one statement: <?php if($profile['Ncolor'] == 1) { ?> <font color="<?php echo $_SESSION['color']; ?>"><?php echo $profile['username']; ?></font> <?php } i guess thats one way of doing it... ill look into that more closely in the future thanks.. P.s anyone know how to make multicolored text? Quote Link to comment Share on other sites More sharing options...
Maq Posted April 1, 2009 Share Posted April 1, 2009 anyone know how to make multicolored text? Example please, this could mean a couple different things. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted April 1, 2009 Share Posted April 1, 2009 i i gue instead of using so many if statements, why not just store the color itself in the database and output it in a $_SESSION['color'] and have just one statement: <?php if($profile['Ncolor'] == 1) { ?> <font color="<?php echo $_SESSION['color']; ?>"><?php echo $profile['username']; ?></font> <?php } i guess thats one way of doing it... ill look into that more closely in the future thanks.. P.s anyone know how to make multicolored text? i'm still kinda new here, so i'm not sure how the mods are about this kind of thing .. but i'm thinking you should maybe open a new thread when asking a question concerning a totally different topic. i could be wrong though. and yes, i have some ideas on how to make multicolored text. Quote Link to comment Share on other sites More sharing options...
seany123 Posted April 1, 2009 Author Share Posted April 1, 2009 i want to have text which is say red but slowly turns purple (fading through the text) i dont know where i can find an example.. should i open a new thread asking about multi-colored text? Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted April 1, 2009 Share Posted April 1, 2009 i want to have text which is say red but slowly turns purple (fading through the text) i dont know where i can find an example.. should i open a new thread asking about multi-colored text? you're looking for a javascript effect i'm thinking .. check out MooTools or jQuery .. they both have excellent libraries .. personally, i like MooTools. Quote Link to comment Share on other sites More sharing options...
seany123 Posted April 1, 2009 Author Share Posted April 1, 2009 okay ill take a look Quote Link to comment Share on other sites More sharing options...
seany123 Posted April 1, 2009 Author Share Posted April 1, 2009 they are linux only programs?? Quote Link to comment Share on other sites More sharing options...
Maq Posted April 1, 2009 Share Posted April 1, 2009 Start a new thread in the proper section (Javascript). AND mark this thread [sOLVED]. Here's one that looks halfway decent. http://www.java2s.com/Code/JavaScript/Ajax-Layer/Textcolorfadein.htm Just google, "javascript color fading text", you will find what you're looking for. Also, it's a good idea to use a libraries like Mootools, scriptaculous, Jquery, etc... It makes things a lot easier, and it's just a good to learn. they are linux only programs?? Maybe do a little research on your own? They are not programs, they are libraries. MooTools - basics Quote Link to comment 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.