Jump to content

[SOLVED] help with queries...


seany123

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 }

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

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.