Jump to content

Select * from Users Where Username...?


Joshua F

Recommended Posts

I have a chatbox I am working on, and it has Username field, and it get the username from the user logged in. So I am trying to make it so that I can make it so staff have different colors/crowns by there name in the box.

 

Here is my code

<?php
list($crowns) = mysql_fetch_row(mysql_query("SELECT * FROM users WHERE username="'chat'.'username'"")) or die (mysql_error());
    while($crn = mysql_fetch_assoc($crowns)) {
if($crn['rights'] == 2){
$crownon = 1;
$crownurl = 'http://runelegend.com/crowns/admin.gif';
$coloron = 1;
$color = '#0066CC';
} elseif ($crn['rights'] == 1) {
$crownon = 1;
$crownurl = 'http://runelegend.com/crowns/mod.gif';
$coloron = 1;
$color = 'red';
} elseif ($crn['rights'] == 0) {
$crownon = 0;
} else {
Die("Error with online list, please contact an administrator.");
}
}
?>

 

I am trying to make it Select Username from users and then if the chat database has that username, it adds the crowns/colors.

Link to comment
https://forums.phpfreaks.com/topic/214471-select-from-users-where-username/
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.