Log in

View Full Version : Change this to get this result



chrjoh88
12-02-2010, 11:58 AM
Hi everyone i have this code,

What i want instead is to use in sed_users a sql table i made for testing at this moment called class in there i have names like
#paladin
#warrior
#shaman
#etc

But im quite new at mysql part and php for that matter but i almost got a finnished product that im happy with this will be one of the main core funcions in my site.

I've got a few hints how to do this but my results is always failing.

$result = "users #".$id; <= to .$class ?
$sql ....("SELECT class?? FROM sed_users WHERE class='".$class."' REMOVE => LIMIT 1 <= REMOVE? ");

$css_group[shaman] this would be the output of what names in class?
$css_group[paladin]

$result = "<a class=\"armory_tip armory_tt_class_".$css_group[$row['class']]."\"

Somthing like that right? in therory im up with this idé, but practical i just fail over and over every time. :confused:

Thanks in advance, every hint of tips would just be a life saver.

Chris.



function sed_build_user($id, $user) {
if ($id==0 && !empty($user)) { $result = $user; }
elseif ($id>0 && empty($user)) { $result = "User #".$id; }
else {
$sql = sed_sql_query("SELECT gru_groupid FROM sed_groups_users WHERE gru_userid='".$id."' LIMIT 1");
$row = sed_sql_fetchassoc($sql);

$css_group[1] = "guests";
$css_group[2] = "inactive";
$css_group[3] = "banned";
$css_group[4] = "Warlock";
$css_group[5] = "Paladin";
$css_group[6] = "moderators";

$result = "<a class=\"armory_tip armory_tt_class_".$css_group[$row['gru_groupid']]."\" href=\"users.php?m=details&amp;id=".$id."\">".$user."</a>";
}
return($result);
}

Schmoopy
12-02-2010, 09:24 PM
I'd be willing to try and help you, but I really don't understand what you're asking. Could you try rephrasing what you've said please?

chrjoh88
12-03-2010, 09:45 AM
First of all Thanks!

This code is about the group ID and when a user is in a group relative to that ID it changes color, but what I want is to use instead of gru_userid is a sql table called class thats in sed_users in there I got names instead of numbers, ex Warrior Paladin etc, I have tryed to change this code to print out the names insead of an ID number.

What I want it to look like is something like this, but I don't know if this is the right way of doing this.

$sql = sed_sql_query("SELECT class FROM sed_users WHERE class='".$?."' varchar 20");

$css_group[paladin] = "Paladin";

class=\"armory_tip armory_tt_class_".$css_group[$row['class']]."\"

Original code:


function sed_build_user($id, $user) {
if ($id==0 && !empty($user)) { $result = $user; }
elseif ($id>0 && empty($user)) { $result = "User #".$id; }
else {
$sql = sed_sql_query("SELECT gru_groupid FROM sed_groups_users WHERE gru_userid='".$id."' LIMIT 1");
$row = sed_sql_fetchassoc($sql);

$css_group[1] = "guests";
$css_group[2] = "inactive";
$css_group[3] = "banned";
$css_group[4] = "Warlock";
$css_group[5] = "Paladin";
$css_group[6] = "moderators";

$result = "<a class=\"armory_tip armory_tt_class_".$css_group[$row['gru_groupid']]."\" href=\"users.php?m=details&amp;id=".$id."\">".$user."</a>";
}
return($result);
}