Jump to content

Ell20

Members
  • Posts

    337
  • Joined

  • Last visited

    Never

Everything posted by Ell20

  1. Dont worry I have worked it out, I used hidden variables to store them then if they just press submit again it submits the same values Appreciate all the help!
  2. Thanks so much for your help! I have one last issue and that is, is there anyway to use the same user values each time the submit button is pressed until the user leaves the page or presses the "reset" button??
  3. Ok now we have colour, BUT its showing them all purple after the first one matches, so say number 10 matches, 10 - 80 are all purple!
  4. For some strange reason, it still dosent show up in purple. I viewed the page source and it says bgcolor="purple" on some of the TD's but it dosent show up on the screen!!
  5. Before I make a mess of doing the other two colours, I tried your code, it dosent appear to do anything in terms of changing the colours?
  6. Thanks for the loop, tidies up the page somewhat. I dont get where you put the foreach loop as I want the colours to change on the already exsisting TD's. Getting late....early here now! 3:30am!!!
  7. DarkWater is there anyway I can incorporate what you did into the current TD's but just change their background colour? Cheers
  8. Here is an example of 1 - 10: <tr> <td width="50" height="25" align="center" onMouseDown="changeto(event, '1')" id="num1" onMouseOver="this.style.cursor='pointer'">1</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '2')" id="num2" onMouseOver="this.style.cursor='pointer'">2</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '3')" id="num3" onMouseOver="this.style.cursor='pointer'">3</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '4')" id="num4" onMouseOver="this.style.cursor='pointer'">4</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '5')" id="num5" onMouseOver="this.style.cursor='pointer'">5</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '6')" id="num6" onMouseOver="this.style.cursor='pointer'">6</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '7')" id="num7" onMouseOver="this.style.cursor='pointer'">7</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '8')" id="num8" onMouseOver="this.style.cursor='pointer'">8</td> </tr> <tr> <td width="50" height="25" align="center" onMouseDown="changeto(event, '9')" id="num9" onMouseOver="this.style.cursor='pointer'">9</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '10')" id="num10" onMouseOver="this.style.cursor='pointer'">10</td>
  9. Ok I think I am getting there: if (isset($_POST['submit'])) { $values = array($_POST['value1'],$_POST['value2'],$_POST['value3'],$_POST['value4'],$_POST['value5'],$_POST['value6'],$_POST['value7'],$_POST['value8'],$_POST['value9'],$_POST['value0']); $nums = array(); $rn = rand(1,80); for ($cnt = 1; $cnt < 21;$cnt++) { while (in_array($rn,$nums)) $rn = rand(1,80); $nums[] = $rn; } foreach ($values as $key=>$value) { if (in_array($value, $nums)) { unset($values[$key]); $keyOfNum = array_search($value, $nums); unset($nums[$keyOfNum]); $matched[] = $value; } } } However I dont want to add a new row, I simply want to change the colour of the existing TD, how would I go about doing that? Cheers
  10. Ok, I dont really have a clue what im doing now but this is the error im getting when I submit: Warning: Invalid argument supplied for foreach() in /home/streety/public_html/keno.php on line 43 if (isset($_POST['submit'])) { $value1 = $_POST['value1']; $value2 = $_POST['value2']; $value3 = $_POST['value3']; $value4 = $_POST['value4']; $value5 = $_POST['value5']; $value6 = $_POST['value6']; $value7 = $_POST['value7']; $value8 = $_POST['value8']; $value9 = $_POST['value9']; $value10 = $_POST['value10']; $nums = array(); $rn = rand(1,80); for ($cnt = 1; $cnt < 21;$cnt++) { while (in_array($rn,$nums)) $rn = rand(1,80); $nums[] = $rn; } foreach ($values as $key=>$value) { //LINE 43 if (in_array($value, $nums)) { unset($values[$key]); $keyOfNum = array_search($value, $nums); unset($nums[$keyOfNum]); $matched[] = $value; } } }
  11. Ok, im just confused as to what code I need and dont need now, do I still need the following code: $nums = array(); $rn = rand(1,80); for ($cnt = 1; $cnt < 21;$cnt++) { while (in_array($rn,$nums)) $rn = rand(1,80); $nums[$cnt] = $rn; }
  12. Hmm I dont understand. Ill try and explain it a bit better. I have a grid of numbers in a table: <td width="50" height="25" align="center" onMouseDown="changeto(event, '1')" id="num1" onMouseOver="this.style.cursor='pointer'">1</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '2')" id="num2" onMouseOver="this.style.cursor='pointer'">2</td> <td width="50" height="25" align="center" onMouseDown="changeto(event, '3')" id="num3" onMouseOver="this.style.cursor='pointer'">3</td> This goes all the way to 80. The user selects any 10 numbers of the 80 and presses submit - this is what is stored in $value1, $value2 etc. On submit 20 numbers need to be randomly generated from between 1 and 80, all 20 numbers must be different. Any numbers which match will turn bgcolor="purple" on the td. Any numbers which the user select which didnt match turn bgcolor="red" on the td. Any numbers which came up from the list of 20 but the user didnt guess turn bgcolor="blue" on the td. Hope this makes it a bit clearer.
  13. It can be however you wish, but I dont quiet get what you have done in your code? How do I use this to get my desired result?
  14. Yeah basically the user selects 10 values which I stored in $value1, $value2......$value10. Then I have used the code below to create 20 random, unique numbers between 1 and 80: $nums = array(); $rn = rand(1,80); for ($cnt = 1; $cnt < 21;$cnt++) { while (in_array($rn,$nums)) $rn = rand(1,80); $nums[$cnt] = $rn; } Then I have 80 td's which store the numbers which I will need to turn a different colour depending on the result.
  15. What I am aiming to do eventually is: - If a number matches turn the background of the td purple - Numbers which the user selected but didnt match turn the background of the td red - Numbers which came up but the user didnt select turn the background of the td blue I cant work out how I am going to link this to the TD either, I will obviously need to add some PHP but I cant work out a decent, sensible solution at the moment. Any help is appreciated.
  16. $nums = array(); $rn = rand(1,80); for ($cnt = 1; $cnt < 21;$cnt++) { while (in_array($rn,$nums)) $rn = rand(1,80); $nums[$cnt] = $rn; echo $nums[$cnt].'<br>'; if ($nums[$cnt] == $value1) { echo 'Match '.$value1.'<br>'; $background = 'purple'; } if ($nums[$cnt] == $value2) { echo 'Match '.$value2.'<br>'; $background = 'purple'; } //etc
  17. Think I have managed to do this now, but not sure its the most efficient way!
  18. Hi, I am generating 20 random, unique numbers and storing them into an array: $nums = array(); $rn = rand(1,80); for ($cnt = 1; $cnt < 21;$cnt++) { while (in_array($rn,$nums)) $rn = rand(1,80); $nums[] = $rn; } I also have 10 numbers chosen by the user stored in variables: $value1, $value2, $value3 etc I cant work out how to run through these numbers looking for matches. Can anyone help me do this? Thanks
  19. Cheers DarkWater, left join worked a treat!
  20. Could but that isnt really an option for me in this case, thanks for the suggestion though.
  21. Replace: if (!isset($_POST['server_name']) || !isset($_POST['server_ip']) || !isset($_POST['server_features']) { With: if (!isset($_POST['server_name']) || !isset($_POST['server_ip']) || !isset($_POST['server_features'])) {
  22. Hi, I have a query at the moment which works fine: $query = "SELECT colour, type, type_2, player_id FROM dom_bogota"; However i would like to also get username from user_info table, I have tried using INNER JOIN: SELECT colour, type , type_2, player_id, username FROM dom_bogota INNER JOIN user_info ON dom_bogota.player_id = user_info.id However this only gives the results where username actually equals something. Is there any way I can do the same thing but receive all results regardless of whether username equals something or not? Thanks for any help!
  23. Hey, I have a drop down box which has two options in it. When 1 of the options is selected I would like a javascript pop up to display asking for confirmation but on the other option this is not nessecary. I tried a javascript popup on submit, but I couldnt get it to work, can anyone help? Cheers
  24. Hi, I have a query $query = "SELECT * FROM dom_london WHERE player_id = '$id'"; $result = mysql_query($query); $rows = mysql_num_rows($result); Which basically counts the number of rows. How would I go about adding an extra table to this query and counting the rows WHERE player_id = '$id'?? Thanks for your help
×
×
  • 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.