Jump to content

tebrown

Members
  • Posts

    114
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

tebrown's Achievements

Member

Member (2/5)

0

Reputation

  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?
×
×
  • 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.