SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 2nd, 2004, 10:20 PM
tpwalker1980 tpwalker1980 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 tpwalker1980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help with form

Ok, so Im making a roster for a guild. On a seperate page it displays all members and what BBforum groups they are in, as well as if you are a member of group id 8 (the members group) it displays a drop down box next to each member name so you can easly change thier rank..

The problem I am having is that it is not passing the info to the sql table for some reason

http://www.gog-dnl.com/modules.php?name=Groups is the actual page so you can see exactly what im talking about.

here is the code
PHP Code:
<?php

if (!eregi("modules.php"$_SERVER['PHP_SELF'])) {

die (
"You can't access this file directly...");

}

require_once(
"mainfile.php");

$module_name basename(dirname(__FILE__));

//$pagetitle = "- "._ENCYCLOPEDIA."";

function displayUsers() {

global 
$module_name$prefix$dbi;



//Get all forum groups

$fgroups sql_query("SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM ".$prefix."_bbgroups ORDER BY group_id ASC"$dbi);

//roll the above into an array indexed by group_id

while(list($group_id$group_type$group_name$group_description$group_moderator$group_single_user) = sql_fetch_row($fgroups$dbi)) {

$group_array[$group_id][] = array($group_id$group_type$group_name$group_description$group_moderator$group_single_user); 

}



//Get group membership info

$mgroups sql_query("SELECT group_id, user_id, user_pending FROM ".$prefix."_bbuser_group ORDER BY user_id ASC"$dbi);

//roll the above into an array indexed by user_id

while(list($group_id$user_id$user_pending) = sql_fetch_row($mgroups$dbi)) {

$mgroup_array[$user_id][] = array($group_id$user_id$user_pending); 

}



//Get website membership info

$members sql_query("SELECT user_id, username, user_rank, recruit_submit FROM ".$prefix."_users ORDER BY user_id ASC"$dbi);

//roll the above into an array indexed by user_id

while(list($user_id$username$user_rank$recruit_submit$ts_submit) = sql_fetch_row($members$dbi)) {

$member_array[$user_id][] = array($user_id$username$user_rank$recruit_submit);

}



//Create member ranks list

$ranks sql_query("SELECT rank_id, rank_title FROM ".$prefix."_bbranks ORDER BY rank_id ASC"$dbi);

while(list(
$rank_id$rank_title) = sql_fetch_row($ranks$dbi)) {

$rank_array[$rank_id][] = $rank_id "~" $rank_title;

}



include(
"header.php");

title("Membership for Forum Usergroups");

//Find and list off users that are not a member of any groups

OpenTable();

$is_empty 1;

echo 
"<table border=0 cellpadding=0 cellspacing=0 align=center width=100%>";

echo 
"<tr><td><b><u>Group:</u></b> Users Not Assigned</td></tr>";

foreach (
$member_array as $value) {//cycle through all members

//User ID: $value[0][0]

//Username: $value[0][1]

$usr_id $value[0][0];

if (
$usr_id != "1") {//no anon

if ($mgroup_array[$usr_id][0][0] == "") {//Not a member of any groups

$is_empty 0;

if (
$member_array[$usr_id][0][3]) {//Recruit App Submitted

$r_stat "Submitted";

}else {

$r_stat "Not Submitted";

}

echo 
"<tr><td style=\"padding-left: 20px;\"><b>User($usr_id):</b> {$member_array[$usr_id][0][1]}</td>

<td><b>Recruit App:</b> {$r_stat}</td>

</tr>"
;

}

}

}

if (
$is_empty) {

echo 
"<tr><td>All users have been assigned to a group.</td></tr>";

}

echo 
"</table>";

CloseTable();

//List off all the groups and their associated members

//$gvalue[0][0] = group_id

//$gvalue[0][2] = group_name

//$gvalue[0][3] = group_description

//$gvalue[0][4] = group_moderator

foreach ($group_array as $gvalue) {//cycle through all groups

if ($gvalue[0][0] != "1") {//remove anon group

$gname $gvalue[0][2];

$mod_id $gvalue[0][4];

$gmod $member_array[$mod_id][0][1];

$desc $gvalue[0][3];



OpenTable();

echo 
"<table border=0 cellpadding=0 cellspacing=0 align=center width=100%>";

echo 
"<tr><td><b><u>Group:</u></b> $gname</td><td><b><u>Moderator:</u></b> $gmod</td><td></td></tr>";

echo 
"<tr><td colspan=3><b><u>Description:</u></b> $desc</td></tr>";



//start form field for rank editing in the GoG group

if ($gvalue[0][0] == "8") {

echo 
"<form action=\"modules.php?name=$module_name\" method=\"POST\">";

echo 
"<input type=hidden name=ranksub value=1>";

}



foreach (
$mgroup_array as $mvalue) {//cycle through users in a group



foreach ($mvalue as $mgvalue) {//users can be members of multiple groups so we have to cycle through all of those

//Group ID: $mgvalue[0]

//User ID: $mgvalue[1]

//Pending: $mgvalue[2]

if ( ($mgvalue[0] == $gvalue[0][0]) && ($mgvalue[1] != "-1") ) {//if member is a part of that group, no anon

if ($mgvalue[2]) {//user is pending in this group

$is_pending "Pending acceptance.";

}else {

$is_pending "Accepted.";

}

$usr_id $mgvalue[1];



$name $member_array[$usr_id][0][1];

echo 
"<tr><td style=\"padding-left: 20px;\">";

if (
$gvalue[0][0] == "8") {//create rank list for this member

//add on this users id and current rank to the list of possibles for processing

$idlist $idlist "~" $usr_id "," $member_array[$usr_id][0][2];

echo 
"<select name={$usr_id}>";

echo 
"<option value=0>No Rank";

foreach (
$rank_array as $rvalue) {//go through each rank 

$ltext explode("~"$rvalue[0]);

if (
$ltext[0] == $member_array[$usr_id][0][2]) {//if ranks match select

$sel "selected";

}else {

$sel "";

}

echo 
"<option value={$ltext[0]} {$sel}>{$ltext[1]}";

}

echo 
"</select>";

}

echo 
"&nbsp;<b>User($usr_id):</b> $name</td><td><b>Status:</b> {$is_pending}</td></tr>";

}

}

}

echo 
"</table>";



//end form

if ($gvalue[0][0] == "8") {

//put out the list of ids and original ranks

echo "<input type=hidden name=idlist value=\"$idlist\">";

echo 
"<br><center><input type=submit value=\"Submit Rank Changes\">&nbsp;&nbsp<input type=reset value=\"Reset Rank Changes\"></center>";

echo 
"</form>";

}



CloseTable();

}

}



include(
"footer.php");

}

 

switch(
$op) {

default:

global 
$dbi;



if (
$ranksub) {//process rank changes

//get the list of possible ids and their ranks

$id_array explode("~"$idlist);

foreach (
$id_array as $value) {//go through each option

//split up the id-rank pair

$auser explode(","$value);

$user_id $auser[0];

$orank $auser[1];

//get rank seleced from the form

$nrank = ${$user_id};

if (
$orank != $nrank) {//update user if different from original

echo "I updated user_id $user_id from $orank to $nrank<br>";

sql_query("UPDATE nuke_users SET user_rank='{$nrank}' WHERE user_id='{$user_id}'"$dbi);

}

}

}

displayUsers();

break;

}

?>


What am I doing wrong it looks as if Im not grabbing the correct info for the rank field since $nrank doesn't actually display anything!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Help with form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway