Results 1 to 3 of 3

Thread: Change this to get this result

  1. #1
    Join Date
    Mar 2010
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy Change this to get this result

    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.

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

    Chris.

    PHP Code:
    function sed_build_user($id$user) {
    if (
    $id==&& !empty($user)) { $result $user; }
    elseif (
    $id>&& 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);


  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    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?

  3. #3
    Join Date
    Mar 2010
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    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:
    PHP Code:
    function sed_build_user($id$user) {
    if (
    $id==&& !empty($user)) { $result $user; }
    elseif (
    $id>&& 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);

    Last edited by chrjoh88; 12-03-2010 at 11:39 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •