Jump to content

tebrown

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by tebrown

  1. Hello, I have implemented the Google Maps API V3 into my popup modal. But when i open the modal, it only displays a portion in the top left corner of the div. You can check it out at this jsFiddle document i have provided: http://jsfiddle.net/tebrown/QsCcn/1/ I have tried putting in google.maps.event.trigger(map, 'resize'); but not sure if the placement is right. Any help would be much appreciated. Cheers tebrown
  2. Think I have got it. foreach($combine as $names => $count) { mysql_query("UPDATE `users` SET `tries` = `tries` +'$count' WHERE `name` = '{$names}' ") or die(mysql_error()); } If you think theres some improvement on this let me know. Cheers Tim
  3. I did originally have this: foreach($players as $scorer) { mysql_query("UPDATE `users` SET `tries` = `tries` +1 WHERE `name` = '{$scorer}' ") or die(mysql_error()); } I think this would work, but it would only select the player and not the amount of tries they scored. Using the example above, ideally Tim would increment by +1, Joe +2, and Ben +2. At the moment, using the code above would only update each player +1. Cheers
  4. jcbones, darkfreaks thankyou! Ok so this will now be updated into the fixtures table. For the second part, how would i do the update for the players statistic 'tries'. So depending on how many tries they score it will update their try count. Cheers Tim
  5. Ok i did it jcbones way and it outputs this: Array ( [Tim] => 1 [Joe] => 2 [ben] => 2 ) Your way, darkfreaks, outputs this: $player = array("Tim","Joe","Ben"); // The players who scored. $count = array("1","2","2"); // The number of trys the player had scored. $combine = $player+$count; $result= implode(", ", $combine); echo $result; Tim, Joe, Ben Cheers
  6. Thanks for the replies, I tried the following: $player = array("Tim","Joe","Ben"); // The players who scored. $count = array("1","2","2"); // The number of trys the player had scored. $combine = array_combine($player, $count); $combine = $player+$count; $result= implode(", ", $combine); echo $result; It only outputs the name though like this: Tim, Joe, Ben Cheers Tim
  7. Hey darkfreaks, I did try that array_combine but couldn't get it work properly either. For example, $player = array("Tim","Joe","Ben"); // The players who scored. $count = array("1","2","2"); // The number of trys the player had scored. $combine = array_combine($player, $count); $result = implode($combine); echo $result; The will output the following: 122 Need it to be exactly like below (as you can see there is no 1 next to Tim, this because he only got the 1 try) Tim, Joe (2), Ben (2) Cheers
  8. Hey Guys, Yesterday i had got this feature to a working standard but the problem that i had that it wasn't very good in terms of usability. Originally, the manager would have the option to click a '+' button in which it would create a drop-dow list. This would allow the user to pick the players who have scored during a match. If there had been a player who had scored 3 times, the user would have to click this 3 times and select the same player each time. I have now changed it so that when the user clicks the + button, it will show a drop-down to select the player and another drop-down next to it, which will allow the user to select the number of tries they have scored. * See attachment for image. This is the form HTML: (There are 2 arrays, items[] and count[]). <select name="items[]" style="width: 200px;"><option value="">Select Player</option><option value="Tim Brown">Tim Brown</option><option value="Bobby Duppree">Bobby Duppree</option><option value="Joe Bloggs">Joe Bloggs</option></select><select name="count[]" style="margin-left:10px;width: 30px;"><option value="">1</option><option value="(2)">2</option><option value="(3)">3</option></select> Ideally I would like to do 2 things from this form. 1) Get the players who have scored and display them. For example, if Tim Brown scores 1 try and Bobby Dupree scores 3 tries it will show like this: Tim Brown, Bobby Dupree (3) This result would be a variable so then i can insert it into the database like it shows above. 2) The second thing i would like to do is update the players statistic 'tries' in the database. This will depend on how much the user sets next to their name. Going of the example above, Tim Brown would increment +1 and Bobby Dupree would increment +3. Yes, i have tried to do this and have got the following, but it defiantly not showing what i want. $fixture = mysql_real_escape_string($_REQUEST['fixture']); $player = $_POST['items']; $count = $_POST['count']; $new_array = array(); foreach ($player as $key => $value) { if(isset($new_array[$value])) $new_array[$value] += $_POST['count'][$key]; else $new_array[$value] = $_POST['count'][$key]; } $column = ""; foreach($new_array as $name => $count) { $column .= $name.($count > 1 ? " (".$count."), " : ""); } $column = trim($column); echo $column; $update_fixture = mysql_query("UPDATE `fixtures` SET `tries` = '$column' WHERE id = '$fixture'") or die(mysql_error()); foreach($player as $scorer) { mysql_query("UPDATE `users` SET `tries` = `tries` +1 WHERE `name` = '{$scorer}' ") or die(mysql_error()); Any help on this would be much appreciated. Thanks Heaps Guys! Cheers Tim
  9. Hello, I'm working on this feature where the user fills out a 'match report' which is used to set the amount of goal scorers in a game. At the moment i have set up a jQuery form which the manager can click the '+' button to add another form select dropdown depending on the amount of scorers within the game. The players who have scored are then stored in an array once submitted. What i would like to do now is assign a variable to each of these players so i can then insert them into the database. What im having trouble with is that what if there are only 4 scorers. How do i assign empty values to the other 3? The columns in the database structure is set out like this, so ideally the players that the manager selects would go into the slots accordingly. goal_scorer_1, goal_scorer_2, goal_scorer_3, goal_scorer_4, goal_scorer_5, goal_scorer_6, goal_scorer_7. This is what i have got so far: $goal_scorers = $_POST['items']; $scorer_1 = $goal_scorers[0]; $scorer_2 = $goal_scorers[1]; $scorer_3 = $goal_scorers[2]; $scorer_4 = $goal_scorers[3]; $scorer_5 = $goal_scorers[4]; $scorer_6 = $goal_scorers[5]; $scorer_7 = $goal_scorers[6]; So if the manager only selects 2 players who have scored, how do i make the other 5 slots be empty so that this notice doesn't happen: Notice: Undefined offset. Any help would be much appreciated. Cheers.
  10. Hey Guys, I've got this mysql_query that shows all the game fixtures within the database on a page. When they are displayed they each have a little icon (share icon) next to the match fixture text. I was wondering if it was possible to click this icon and then it would post the match fixture to a specific page onto facebook? Cheers
  11. Found a solution. Thanks anyway! Cheers
  12. Sorry, were you asking me to do this? <?php $test = mysql_query("SHOW CREATE TABLE fixtures") or die(mysql_error()); echo $test; ?>
  13. CREATE TABLE `fixtures` (`id` int(11) NOT NULL ...
  14. I need to update all fixtures where the current time has passed the fixture time. The query will then update the column 'status' to '2'. I then need to GET the fixtures that it just updated so i can run another query that will notify the managers of those fixtures.
  15. Would that go beneath the UPDATE?
  16. Ok so lets say that msyql query runs and it finds 1 fixture that has passed its fixture time, i want to be able to get the id of that fixture so i can then run a another mysql_query that will notify the manager to let him know the current time has passed the fixture time. Hope that makes sense.
  17. And how would i find that fixture that it actually gets if the current time passes the fixture time?
  18. How could I improve this to do the same effect then? - and also the question that i had asked? Much regards, tebrown
  19. Hey Guys, I have setup a mysql query that is run everytime the page is refreshed. Its on my page called secure.php, which is on everypage within my website. At the moment it finds all the fixtures in the database and checks if the current time has passed its specific time. It all works fine but im wanting to get that specific fixture_id so that i can then send a notification to the manager saying that the current time has passed ur fixture time. $fixture = ("SELECT * FROM `fixtures`") or die(mysql_error()); $resultfixture=mysql_query($fixture); if (mysql_num_rows($resultfixture) != 0) { while($rows = mysql_fetch_array($resultfixture)) { mysql_query("UPDATE `fixtures` SET `status` = '2', `result`='TBA' WHERE UNIX_TIMESTAMP() > `time` AND `status`='1'") or die(mysql_error()); } } Any help much appreciated! Cheers
  20. Thanks Christian. I changed the output variables to something else and defined the specific position. Will repeat this process for each position. I will look into the JOIN aswell. Cheers Guys Tim
  21. Cheers ChristianF, So i tried to create another $output but the $hooker doesn't seem to be in the select box. <?php $conn = mysql_connect ('localhost', 'root', 'root') or die ("Couldn't connect to database."); mysql_select_db ('2012MP', $conn) or die ("Error selecting database."); $selectplayers = "SELECT * FROM users WHERE club='Inglewood' AND team='Senior As' AND role='Player' ORDER BY name DESC"; $playerselected = mysql_query ($selectplayers); while ($rowplayer = mysql_fetch_array ($playerselected)) { $full_name[] = $rowplayer["name"]; } $id = '24'; $query = "SELECT * FROM fixtures WHERE id='$id' AND club='Inglewood' AND team='Senior As'"; $selectfixture = mysql_query ($query) or die (mysql_error ()); // Ready the output variable. $output = ''; $hooker = ''; while ($rowfixture = mysql_fetch_array ($selectfixture)) { $prop1 = $rowfixture["prop1"]; $hooker = $rowfixture["hooker"]; $output .= '<select name="prop1" style="width: 150px"><option value="">Select A Player</option>'; foreach ($full_name as $player) { if ((isset ($_POST['prop1']) && $_POST['prop1'] == $player) || $player == $prop1) { $sel = 'selected="selected"'; } else { $sel = ''; } // TODO: You need to set a value here, preferably using the ID of the player. $output .= '<option ' . $sel . '>' . $player . '</option>'; } $output .= '</select>'; $hooker .= '<select name="hooker" style="width: 150px"><option value="">Select A Player</option>'; foreach ($full_name as $player) { if ((isset ($_POST['hooker']) && $_POST['hooker'] == $player) || $player == $hooker) { $sel = 'selected="selected"'; } else { $sel = ''; } // TODO: You need to set a value here, preferably using the ID of the player. $hooker .= '<option ' . $sel . '>' . $player . '</option>'; } $hooker .= '</select>'; } ?> Cheers
  22. In the mean time i had done this. But it seems to disappear/ lost when the page is loaded. Basically i want it to show the database result in the dropdown (if there is any). The manager can then choose a different player if he wanted to. <td width="132" valign="top"><? $conn = mysql_connect('localhost', 'root', 'root') or die("Couldn't connect to database."); mysql_select_db('2012MP', $conn) or die("Error selecting database."); $selectplayers="SELECT * FROM users WHERE club='Inglewood' AND team='Senior As' AND role='Player' ORDER BY name DESC"; $playerselected=mysql_query($selectplayers); while($rowplayer = mysql_fetch_array($playerselected)) { $name=$rowplayer["name"]; $full_name[] = $name; } $id = '<div id="showvalue"></div>'; $selectfixture= mysql_query("SELECT * FROM fixtures WHERE id='$id' AND club='Inglewood' AND team='Senior As'") or die(mysql_error()); while($rowfixture = mysql_fetch_array($selectfixture)) { $prop1= $rowfixture["prop1"]; ?> <? echo '<select name="prop1" style="width: 150px"><option value="">Select A Player</option>'; foreach($full_name as $o) { if(isset($_POST['prop1']) && $_POST['prop1'] == $o) {$sel = 'selected="selected"';} elseif(isset($_POST) && $o == $prop1) {$sel = 'selected="selected"';} else{$sel='';} echo '<option '.$sel.'>'.$o.'</option>'; } echo '</select>'; } ?></td>
  23. Thanks for your replys. Ok i think the above code you posted relates to what im needing. Just to make sure ill explain. Basically a manager gets a list of fixtures for upcoming games. He/ or she can then click 'create lineup', which then brings up a modal window so they can then pick their lineup. When the manager selects a player for each position he/ or she can then save the lineup, which would then close the modal window. If they decide go back into the modal window and edit the lineup, the players that he/ or she selected would automatically fill the select option. Would the code above be ideal for this?
  24. Recently i've been working on a drop-down list that is populated with results from my database. Ideally the code below would allow a manager to choose a player from the dropdown list and then save it. If the manager has already saved the lineup, and goes back to it, the player that he saved would populate that drop down automatically (so he doesn't have to choose him again). At the moment, the code below is not populating the players from the database. Could you please have a look? <td width="132" valign="top"><? selectplayers="SELECT * FROM users WHERE club='" . $_SESSION['club'] . "' AND team='" . $_SESSION['team'] . "' AND role='Player' ORDER by name DESC"; $player=mysql_query($selectplayers); while($rowplayer = mysql_fetch_array($player)) { $name=$rowplayer["name"]; } $id = '<div id="showvalue"></div>'; $selectfixture="SELECT * FROM fixtures WHERE id='$id' AND club='" . $_SESSION['club'] . "' AND team='" . $_SESSION['team'] . "'"; $fixture=mysql_query($selectfixture); while($rowfixture = mysql_fetch_array($fixture)) { $prop1= $rowfixture["prop1"]; } echo '<select name="prop1"><option value="">Select A Player</option>'; foreach($name as $o) { if(isset($_POST['prop1']) && $_POST['prop1'] == $o) { $sel = 'selected="selected"'; } elseif(isset($_POST) && $o == $prop1) { $sel = 'selected="selected"';} else{$sel='';} echo '<option '.$sel.'>'.$o.'</option>'; } echo '</select>'; ?></td> Cheers guys much appreciated. Tim
  25. Ok i found a solution but i'm not sure how safe in regards to coding standards. jQuery(function ($) { // Load dialog on click $('.basic').click(function (e) { var id = $(this).attr("href"); $('#showvalue').text(id) $('#content-one').modal({ overlayClose:true, opacity:40 }); return false; }); }); When the user clicks a specific fixture from the list, it will open the modal and then show the id number within the div 'showvalue'. To echo it out i did the following. $id = '<div id="showvalue"></div>'; echo $id; Tell me what you think. Cheers
×
×
  • 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.