Jump to content

Jay2391

Members
  • Posts

    167
  • Joined

  • Last visited

    Never

Everything posted by Jay2391

  1. hey guys I was trying a few of this ideas but they didn't work anyone else know what to do ??? and make it simple i have a pres et number X belive is 4 I need 1 thru 4 randon and no duplicates in a variable.. I did it on top but it get complicated when that number changes
  2. I have an array and I am trying to check that if any of the field rank =0 to stop and not continuiing with the code... the issue is that the first record comes 0 but the next is 2 so when it gets the value it overides... how can i stop the while loop and continue with the next code i try end but didn't work while($r_row2 = mysql_fetch_array($r_result2)){ $r_rank2 = $r_row2['rank']; if($r_rank2 == 0){ echo "<br>Tournament is not open for play"; $tournament = FALSE; end(); }else{ $tournament = TRUE; }
  3. that work FYI I figure it out... is there a better way let me know echo "<br><a href=\"tourney_admin.php?tourney_id=$tourney_id&switch=on\">Turn on </a>"; echo "<br><a href=\"tourney_admin.php?tourney_id=$tourney_id&switch=off\">Turn on </a>"; echo "<br>$switch"; if($switch == on){
  4. okay here is what I am thinking I have some code anything that when runs displays "hello world!!!" So I want to create a link of a button that displays and removes the item in the same screen I know this is not correct and it dosen't have to be a button it can be a simple link I am carrying an ID value that i must preserve on the Self.PHP post... I know I am wrong but I am loooking for clues.. here are my toughts: print '<h4><form action = "self.php" method="post">$on=TRUE<p>'; if($on== FALSE and $off == TRUE){ <---- Current stage when oppening page code = TRUE: if(code == TRUE){ run code } } print '<br><input type="submit" name="submit" size"20" value="on"/><br /></h4>'; then have another button that says the oposite print '<h4><form action = "self.php" method="post">$on=false<p>'; if($on== TRUE and $off == FALSE){ code = TRUE: if(code == TRUE){ run code } } print '<br><input type="submit" name="submit" size"20" value="off"/><br /></h4>';
  5. this is what i need it ... thnaks <?php if(in_array($activity, range(1,6))){ $activity1 = "New Member"; } ?>
  6. I am trying to diplay a message base on data from a range so I want something like if the code below... if($activity == 1 or 2 or 3 or 4 or 5 or 6 ){ $activity1 = "New Member"; } is there a way to do like the random function like from 1 to 6 I try this but is incorrect... if($activity == (1, 6)){ $activity1 = "New Member"; } I am looking for the correct way ...to do that
  7. I know I can do this .... print "<form action=\"page.php?page_id=$page_id\" method=\"post\">"; and add a get_id statement on a page but can you create a double id... print "<form action=\"page.php?page_id=$page_id?page_id2=$page_id2\" method=\"post\">"; and get it ... this may be wrong but just checking  :-\
  8. I like to use the include(); and i save my table names and my functions there anyway i figure out what as wrong $chg_player variable was not carring over ... thanks anyway
  9. same error... and $tabletr is a variable with the table name
  10. I cut off lot of the code fo simplicity but the main goal is to update an existing table in whish i will update multiple fields at a one time with a post submition... I get this error.. Cannot Update TableYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET win='', loss='', tie='', rank='', eliminated='', fi' at line 1 [code] print "<form action=\"Slef" method=\"post\">"; print 'W: <input type="text" name="win_update" size"20" value="' . $_POST['win_update'] . '"/><br />'; print 'L: <input type="text" name="loss_update" size"10" value="' . $_POST['loss_update'] . '"/><br />';  print '<br><input type="submit" name="submit" size"20" value="Update Records"/><br /></h4>';                         $win_update = $_POST['win_update'];                                                   $loss_update = $_POST['loss_update']; $user_update = "UPDATE $tabletr SET win='$win_update', loss='$loss_update'           WHERE user_name='$chg_player'";                          mysql_query($user_update) or die ("Cannot Update Table". mysql_error()); ?> [/code]
  11. Well that didn't work so i decided to change I am trying to get drop down menus.... but I am having similar issues here is my drop down menu code but it dosen't select the item... the munu box shows up and i can select and click but it dosen't store the values... ??? ??? ??? [code]   $query_list = "SELECT * FROM $tabler WHERE (tourney_name=\"$tourney_name\")"; $result_list = mysql_query($query_list, $tc);     print '<h4><form action = "tourney_admin.php" method="post"><p>': print '<p><label>Player: <select name="player_list">           <option value="">- - -Chose an player - -</option>';                                           while($row_list = mysql_fetch_array($result_list)){ $player_list = $row_list['user_name'];                 print "<option value=\"$player_list\">$player_list<br></option>";         }   print "</select></p>\n";          print '<p><input type="submit" name="change" value="Submit Change" /></label></p>                      </form>';   [/code]
  12. the numbers need to be store in separate variables so they can be assigned...like userx will be rank 4 userb will be rank 2 but they can't be duplicated that is why the number need to be store in a unique variable
  13. I am trying to store randon numbers in variable without haven't any duplicates I did this ... I just want to know if there is a easier way because i what to know what to do when i get to 32 teams...I mean this works just a lot of code ::) [code]<?php $teams = 4; if ($teams == 4){ $random1 = rand (1,$teams); $random2 = rand (1,$teams);    $random3 = rand (1,$teams); $random4 = rand (1,$teams); while($random1 == $random2 or $random1 == $random3 or $random1 == $random4       or $random2 == $random3 or $random2 == $random4 or $random3 == $random4){         $random2 = rand (1,$teams);            $random3 = rand (1,$teams);         $random4 = rand (1,$teams);     } echo "$random1<br>"; echo "$random2<br>"; echo "$random3<br>"; echo "$random4<br>"; } ?>[/code]
  14. Parse error: parse error, unexpected T_VARIABLE, expecting ']' in C:\XAMPP\xampp\htdocs\MDO\test.php on line 235 [code] <?php $games_to_be_played  = 3; $query = "SELECT * FROM your_table"; $result = mysql_query($query, $tc);                              $i = 1; while($row = mysql_fetch_array($result)){ if($t_name == $row['t_name'] && $game == $row['game']){         echo "<p><h4>". $row['user_name'] ."<br></h4></p>\n";              if($games_to_be_played == 3){ print "<h4><form action=\"". $_SERVER['php_self'] ."\" method=\"post\"><p>\n"; [color=red]for me is this line----->[/color] print "Score Round ". $i .": <input type=\"text\" name=\"scor". $i ."\" size=\"50\" value=\"". $_POST[scor$i] ."\">\n"; print "<input type=\"submit\" name=\"submit\" size=\"20\" value=\"Enter Score\">\n"; print "</form></h4>\n"; } } $i++; } ?> [/code]
  15. the code is missing something I tough it was a '  \  ' in this area... value=\"". $_POST[scor$i] ."\">\n"; but i get a Parse error: parse error, unexpected T_VARIABLE, expecting ']' in C:\XAMPP\xampp\htdocs\MDO\tourney_admin.php on line 235 [code] if($games_to_be_played == 3){ print "<h4><form action=\"". $_SERVER['php_self'] ."\" method=\"post\"><p>\n"; print "Score Round ". $i .": <input type=\"text\" name=\"scor". $i ."\" size\"50\" value=\"". $_POST[scor$i] ."\">\n"; print "<input type="submit" name="submit" size"20" value="Enter Score">n"; print "</form></h4>n"; }[/code]
  16. My question is if there is a better WAY!!!! to create that code I did above.... mybe things that will help are .... can I insert a variable in here ...red area print '<p>Score Round 1: <input type="text" name="scor1" size"5" value="' . $_POST[[color=red]'scor1'[/color]] . '"/>'; the issue is that i can print the boxes but they are all id the same way so I need the input boxes to be unique assing to that player player 1 has 2 input boxes player 2 has 2 input boxes player 3 has 2 input boxes player 4 has 2 input boxes [color=red][font=Verdana]but the boxes are name "scor1 and scor2" in all the lines so when you update scor1 it will update "scor1" in the database for all of the one call "scor1"[/font][/color] so I am trying to figure out a better WAY .... Sorry about the CODE # THING
  17. By the way this is the way the lines should look like I was type it in before so I am missing some '' marks and stuff if ($games_to_be_played == 2){     print '<p><h4><form action = "tourney_admin.php" method="post"></p>';                               print '<p>Score Round 1: <input type="text" name="scor1" size"10" value="' . $_POST['scor1'] . '"/>';                               print '<input type="submit" name="submit" size"20" value="Enter Score"/></h4></p>';                               print '<p><h4><form action = "tourney_admin.php" method="post"></p>';                               print '<p>Score Round 2: <input type="text" name="scor2" size"10" value="' . $_POST['scor2'] . '"/>';                               print '<input type="submit" name="submit" size"20" value="Enter Score"/></h4></p>'; }
  18. I am looking for a better way to do this ... $games_to_be_played  is the amount of maximun games a player will play in a tournament so if the maximun games to be played is "x" number then I should get the same number of "x" $scorX variable to imput scores... or is this even correct.... $games_to_be_played  = 3; $query = "SELECT * FROM $table "; $result = mysql_query($query2, $tc);    while($row = mysql_fetch_array($result)){   if($t_name == $row['t_name'] and $game == $row['game']){         $result_id = $row['result_id'];         $player = $row['user_name'];         $win = $row['win'];         $loss = $row['loss'];;         $tie = $row['tie'];;         $rank = $row['rank'];;         $scor1 = $row['scor1'];         $scor2 = $row['scor2'];         $scor3 = $row['scor3'];         $scor4 = $row['scor4'];         $scor5 = $row['scor5'];           print "<p><h4$playerbr></h4></p>";           if ($games_to_be_played == 3){               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 1: <input type="text" name="scor1" size"50" value="' . $_POST['scor1'] . '"/><br />'               print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 2: <input type="text" name="scor2" size"50" value="' . $_POST['scor2'] . '"/><br />'               print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 3: <input type="text" name="scor3" size"50" value="' . $_POST['scor3'] . '"/><br />' print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';             }       if ($games_to_be_played == 4){                             print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 1: <input type="text" name="scor1" size"50" value="' . $_POST['scor1'] . '"/><br />'               print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 2: <input type="text" name="scor2" size"50" value="' . $_POST['scor2'] . '"/><br />'               print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 3: <input type="text" name="scor3" size"50" value="' . $_POST['scor3'] . '"/><br />' print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 4: <input type="text" name="scor4" size"50" value="' . $_POST['scor4'] . '"/><br />'               print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';               print '<h4><form action = "samepage.php" method="post"><p>';               print Score Round 5: <input type="text" name="scor5" size"50" value="' . $_POST['scor5'] . '"/><br />' print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';       }           print '<br><input type="submit" name="submit" size"20" value="Enter Score"/><br /></h4>';
  19. I have this condiction an I get the ... Registration Closed part so i know that $tfull == TRUE is working now i want to get status to update on the table from 1 to 2... what am i missing ... if($tfull == TRUE){       echo "<br>Registration Closed";       $staus_2 = 2;       $change = "UPDATE $tablet SET (status=\"$status_2\") WHERE (tourney_id=\"$tourney_id\")";   }
  20. that work thanks I was puting a variable the straight array work !!!
  21. okay I have this code ...in where you put the name of a game in the field and post it ....and works what i want is to change it from a text field to a drop down option field table: $tablex  from colum: $game_name this is the code right now... print '<h4><form action = "tourney_main.php" method="post"><p>';     print   '<style type="text/css">    <!--   .style9 {font-size: 11px; font-family: Verdana;}    -->   </style>    <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col"> <div align="left" class="style9">Game:</div></th>     <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col"> <div align="left" class="style9"><input type="text" name="game" size"100" value="' . $_POST['game'] . '"/></div></td>   </tr>   print '<br><input type="submit" name="submit" size"20" value="Create Tournamnet"/><br /></h4>'; my toughts where to put a table query and a while statement but it dosen't seem to work inside a table.
  22. Okay i am a genius here is the code     $b_query = "SELECT * FROM $tabler WHERE (tourney_name=\"$tourney\")ORDER By 'rank' ";     $b_result = mysql_query($b_query);     while($b_row = mysql_fetch_array($b_result)){ $count = $count + 1;         }         $total_teams = $count;         $open_teams = $max_teams - $count; $total_games = $count / 2; echo "<br>Open Spots: $open_teams"; echo "<br>Total Teams: $total_teams"; echo "<br>Total Games: $total_games"; print "<br><br><p><h5>Schedule Games and Times:</h5></p>";     $b2_query = "SELECT * FROM $tabler WHERE (tourney_name=\"$tourney\")ORDER By 'rank'";     $b2_result = mysql_query($b2_query); print "<br><p>Round:</p>"; while($b2_row = mysql_fetch_array($b2_result)){   if($total_games != 0){     $b2_rank= $b2_row['rank']; $b2_user_name = $b2_row['user_name']; $b3_query = "SELECT * FROM $tabler WHERE (rank=\"$total_teams\")";             $b3_result = mysql_query($b3_query);                 $b3_row = mysql_fetch_array($b3_result);       $b3_rank= $b3_row['rank'];     $b3_user_name = $b3_row['user_name'];     print "<p>$b2_rank - $b2_user_name</p>"; print "<p>$b3_rank - $b3_user_name</p>";         $total_games = $total_games -1; $total_teams = $total_teams -1;                           if($total_games == 0){           echo "Bracket Completed!!!";           }   }         }
  23. I have 4 teams Ranks 1 thru 4 and this number could change to 8, 16, ect.... So i set up a code that tells me the number of teams and ranks them example ...4 teams but I want to display them like this .... the condiction is that it display them based on the number of teams... and remember they can't change.. Rank 1 Rank 4 <br> Rank 3 Rank 2 my logic.... $lownum = lowes number (1) $highnum = highest number (4) Echo $lownum $highnum <br> $lownum+1 $highnum -1 the issue is that as i increase the number of teams i do not know how to select them???
×
×
  • 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.