Jump to content

Archived

This topic is now archived and is closed to further replies.

chriscloyd

INSERT HELP

Recommended Posts

okay i have a tournament script where people and teams can sign up but i need help witht eh joing a team part like when they click on the link join team it shows a drop down list of all the team names and under that drop down theres another input box for a password i want them to enter the team password and if the team password is correct i want it to update the field in the user table under the row of the persons username can some one help me

Share this post


Link to post
Share on other sites
[!--quoteo(post=353057:date=Mar 8 2006, 11:09 PM:name=chriscloyd)--][div class=\'quotetop\']QUOTE(chriscloyd @ Mar 8 2006, 11:09 PM) [snapback]353057[/snapback][/div][div class=\'quotemain\'][!--quotec--]
okay i have a tournament script where people and teams can sign up but i need help witht eh joing a team part like when they click on the link join team it shows a drop down list of all the team names and under that drop down theres another input box for a password i want them to enter the team password and if the team password is correct i want it to update the field in the user table under the row of the persons username can some one help me
[/quote]

if it was me, I'd query the teams database and get the teamid and the team name, and store them in an array. Then I'd use the array to poplulate a drop down list with the team names.

When the visitor enters a password, it would send the teamid and the password to another page which would do a query to the team table and check the password is correct for that team, if it is, then it would enter the user details into the user table along with the teamid.

for example,

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
$count;
$sql = "SELECT teamid, teamname FROM teamtable ORDER BY teamname ASC";
$sql_result = mysql_query($sql,$database) or die(mysql_error());
while ($row = mysql_fetch_array($sql_result)) {
$teamid[$count] = $row['teamid'];
$teamname[$count] = $row['teamname];
$count++;
}

// then to create the drop down list you would do

<select name="teams">
<option value=" " Selected> </option>
<?php
$rc = 0;
while ($teamid[$count] <> '') {
echo "<option value='".$teamid[$count]."'>".$teamname[$count]."</option>";
$rc++;
}
?>
</select>

[/quote]

Share this post


Link to post
Share on other sites

×

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.