Jump to content

penguin0

Members
  • Posts

    121
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

penguin0's Achievements

Member

Member (2/5)

0

Reputation

  1. Just so everyone's clear: The only error with my script is that I was using if(isset($groups[$groupname])){ } and that will only work with radios and check boxes so it was omitted.
  2. I fixed this myself: $result2 = mysql_query( "SELECT id, color, name, level FROM groups ORDER BY level" ); $num_rows = mysql_num_rows( $result2 ); $groups = array(); while ( $b_row = mysql_fetch_array( $result2 ) ) { $gid = $b_row['id']; $gname = $b_row['name']; $color = $b_row['color']; $level = $b_row['level']; $Info = array( "id" => $gid, "color" => $color, "level" => $level ); $groups = array_merge($groups, array($gname => $Info)); } $sql = "SELECT * FROM users WHERE status = 'perm' ORDER BY id"; $result = mysql_query($sql, $link) or die(mysql_error()); $num_rows = mysql_num_rows( $result ); while ( $a_row = mysql_fetch_array( $result ) ) { $group = $a_row['group']; foreach(array_keys($groups) AS $key => $groupname){ if($group == $groups[$groupname]['id']){ $colors = $groups[$groupname]['color']; } }
  3. $groupname is assigned to the arrays keys which coincidently are the group names: Array ( [0] => Administrators [1] => Officers [2] => Moderators [3] => Members [4] => New Recruits ) I don't have the following varables $member, $members What I am ultimatly trying to do is get $displayname colored by the variable $color Also I do not know which loop that should go in. Could you please take a look at the code posted and show me where that goes and what would have to be changed to my variables? This is where it ultimately will be displayed: $table_block .= "<tr><td>$onlinepic <font color=\"".$groups[$groupname]['color']."\">$displayname</font></td><td>$position</td><td class=ac>$charactern</td></td><td><a href=\"mailto:$email\" class=\"links\">$email</a></td><td>$newcreated</td></tr>";
  4. I echoed $groupname and I get all the group names: AdministratorsOfficersModeratorsMembersNew Recruits Any other ideas?
  5. If that was the case then $colors wouldn't be working at all. It does pull the last value of color out of the array. I am just trying to pull the color that corresponds to the group ID that is stored for each user. Please take a look at the array and maybe that will help: Array ( [Administrators] => Array ( [id] => admins32 => #90000 [level] => 0 ) [Officers] => Array ( [id] => officers6642 => #0066CC [level] => 1 ) [Moderators] => Array ( [id] => mods2234 => Yellow [level] => 2 ) [Members] => Array ( [id] => members6543 => #FFFFFF [level] => 3 ) [New Recruits] => Array ( [id] => newreq2321 => pink [level] => 4 ) )
  6. I am trying to use the array $groups which has the group tables information to check a users group (in the user table) and choose the appropriate color from the group table. $result2 = mysql_query( "SELECT id, color, name, level FROM groups ORDER BY level" ); $num_rows = mysql_num_rows( $result2 ); $groups = array(); while ( $b_row = mysql_fetch_array( $result2 ) ) { $gid = $b_row['id']; $gname = $b_row['name']; $color = $b_row['color']; $level = $b_row['level']; $Info = array( "id" => $gid, "color" => $color, "level" => $level ); $groups = array_merge($groups, array($gname => $Info)); } $sql = "SELECT * FROM users WHERE status = 'perm' ORDER BY id"; $result = mysql_query($sql, $link) or die(mysql_error()); $num_rows = mysql_num_rows( $result ); while ( $a_row = mysql_fetch_array( $result ) ) { $group = $a_row['group']; foreach(array_keys($groups) AS $key => $groupname){ if(isset($groups[$groupname])){ if($group = $groups[$groupname]['id']){ $colors = $groups[$groupname]['color']; } } $id = $a_row['id']; $name = $a_row['name']; $position = $a_row['position']; $charactern = $a_row['charactern']; $displayname = $a_row['displayname']; $realm = $a_row['realm']; $email = $a_row['email']; $online = $a_row['online']; $created = $a_row['created']; $newcreated = date('m/d/Y h:i:s A', $created); if ($online == 1) { $onlinepic = "<img src=\"images/online.gif\">"; } else { $onlinepic = ""; } } Here is an example of how all that code will be output: $table_block .= "<tr><td>$onlinepic <font color=\"".$groups[$groupname]['color']."\">$displayname</font></td><td>$position</td><td class=ac>$charactern</td></td><td><a href=\"mailto:$email\" class=\"links\">$email</a></td><td>$newcreated</td></tr>"; *in the code $group would be the same as one of these "$groups[$groupname]['id']". As you can see I am checking to see if $group equals one of the groups while pulling the user table. My problem is it only uses the color of the last group and every user gets that color, and not the color they are assigned by group.
  7. Is there a way to do what I said last?
  8. try $newDest = './upload/'.$photoName;
  9. Can you post your code? Telling us there is no errors means there might be suppressors on, but does not help.
  10. depends on if you want the javascript header lower or the image. you can change the offset of the javascript in the config file.
  11. I didn't mean put php in a css form, but can't you use fopen to change a .css around?
  12. For the image to work it needs to be: $handle = opendir('./images'); while ($file = readdir($handle)) { echo "<img src=\"images/$file\" alt=\"\" /><br />\n"; } closedir($handle);
  13. echo "<a href=?id=indx>Home</a><br><a href=?id=link>Links</a><br><a href=?id=dl>Downloads</a>"; ?> How is all the other html on the page displayed? If it is all in a table, then it is in the wrong cell.
×
×
  • 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.