Jump to content

OutOfInk

Members
  • Posts

    21
  • Joined

  • Last visited

OutOfInk's Achievements

Member

Member (2/5)

0

Reputation

  1. I have two tables that relate to each other; tableA has a Columns ID, NAME, BETRESULT tableB has all the users register data; Each user places a bet on a sport for the week and they either win or lose there credits. What i wish to do is take away 20 credits from users that dont place a bet for the week. So anyone that does bet i INSERT a new row into tableA. I need to some how work out what usernames havent bet in tableA and remove 20 credits from tableB; I wrote this query but it ended up taking 20 credits off every user. SELECT bets.name, Register.SNAME FROM bets INNER JOIN Register ON bets.name = Register.SNAME If someone could help thanks in advance!
  2. I want to ORDER my results by the amount of credits a user has so we can see who is on the leaderboard placings. The problem is I need to have an addition as there new bet must be included in the result to make the results true; is there something that works like follows? ORDER BY `tableA.credits` + `tableB.newBet` LIMIT 0,150 using a join with an addition?
  3. Thanks mac_qyver, I've imploded them as so $imp = implode("', '", $llec); But mysql is still saying theirs an error with my array data SELECT `name` , `bet` FROM `table` WHERE `round` = '$round' AND `placed_on` IN ('Richmond','Carlton','Port Adelaide','GWS Giants','Hawthorn','West Coast','North Melbourne','Draw','Draw') I run this as a test and it said theirs a error
  4. I havew populated $llec as an array with nine teams and i need to extract all users who have bet on any of these options, ive tried everything i can think of so far so if someone has a solution would be awesome. Ive tried a for () statement as well with no luck. $i = 0; $puntBets = mysql_fetch_row(mysql_query("SELECT `name` , `bet` FROM `tablebets` WHERE `placed_on` = '$llec[$i]' AND `round` = '$round'")); $i++;
  5. QuickOldCar how about posting something constructive and useful in a php help forum instead of wasting a post being a forum nazi.
  6. Thanks Ch0cu3r, that helped a lot, the only thing im still having trouble with is carrying the ID which i need to relate to the table row for each of those games. $closeselect[0] is important to be carried as that indexs the specific row that $closeselect[1], $closeselect[2] or Draw relate too. At the moment it now gathers the correct option with the radio checked for any of the options but how can i grab that $closeselect[0]
  7. I have multiple checkboxes which im submitting data from and need to retrieve that data. I need to be able to get closewin[$i] and winner[$i] into the same foreach() statement so that it stops defaulting to the first 0 to 8 options; my code is below; I have placed $o++ in there to make all closewin[$i] options different <?php $fuck = $globalRound[0] - 1; // On round 3 if (isset($_POST['subclose'])){ foreach ($_POST['winner'] as $index => $value){ $a = $_POST['closewin']; $b = $value; $q = mysql_fetch_row(mysql_query("SELECT FROM WHERE `` = '$b[$i]'")); if ($a[$i] = $q[0]){ $d = $q[0]; $e = $q[1]; }else{ $d = $q[1]; $e = $q[0]; } mysql_query("UPDATE "); echo "You have selected $a[$i] as the winner!<br />"; echo "---------------------------<br />"; } echo "<b>You have closed Round $fuck, leaderboard is now updated, ppc credited for winners!</b><br />"; } ?> <form action="/p.php" method="post" name="closeg"> <table border='1' cellpadding='2' cellspacing='0' bordercolor='#000000' class='sub2' width="620"> <tr class="innertable"><td align="center" colspan="2"><b>Close Round / Update Leader Board / Credit PPC wins</b></td></tr> <?php $i = 0; $o = 9; $selectclose = mysql_query("SELECT `id` , `Home` , `Away` FROM `` WHERE `Round` = '$fuck'"); while ($closeselect = mysql_fetch_row($selectclose)){ echo " <tr class=innertable> <td> <input type='hidden' name='winner[$i]' value='$closeselect[0]'> <input type='checkbox' class='input' name='closewin[$i]' value='$closeselect[1]'>$closeselect[1] </td><td> <input type='checkbox' class='input' name='closewin[$o]' value='$closeselect[2]'>$closeselect[2]</td> </tr>"; $i++; $o++; } ?> <tr><td align="right" colspan="2"><input type="submit" name="subclose" class="input" value="Close Round" /></td></tr> </table> </form> The html form appears like the following; Close Round / Update Leader Board / Credit PPC wins Pleae double check winners before submitting to close the round as once entered, to undo would be impossible. [checkbox] Hawthorn | [checkbox] Fremantle [checkbox]Western Bulldogs | [checkbox]Richmond [checkbox]Adelaide | [checkbox]Sydney [checkbox]Gold Coast | [checkbox]Brisbane Lions [checkbox]Collingwood | [checkbox]Geelong [checkbox]West Coast | [checkbox]St Kilda [checkbox]GWS Giants | [checkbox]Melbourne [checkbox]North Melbourne | [checkbox]Port Adelaide [checkbox]Essendon | [checkbox] Carlton and when submitted with all the right hand side 9 to 17 checkboxes selected it defaults to the left options; You have selected Hawthorn as the winner! --------------------------- You have selected Western Bulldogs as the winner! --------------------------- You have selected Adelaide as the winner! --------------------------- You have selected Gold Coast as the winner! --------------------------- You have selected Collingwood as the winner! --------------------------- You have selected West Coast as the winner! --------------------------- You have selected GWS Giants as the winner! --------------------------- You have selected North Melbourne as the winner! --------------------------- You have selected Essendon as the winner!
  8. Am i better off using a join or between statement and if possible please leave an example. I want to retrieve the current 'round' from my database. To do this i need to compare the current date and time to the 'gameround' table 'Date' and 'Time'. This is an example of the database im trying to work which round it is; CellID Round Home HODDS Away AODDS Ground Date Time status won lost 1 1 Collingwood 2.40 Fremantle 1.70 Etihad 2014-03-14 19:50:00 Lock None None 2 1 GWS Giants 15 Sydney 1.00 Skoda 2014-03-15 16:40:00 Lock None None 3 1 Gold Coast 2.50 Richmond 1.60 Metricon 2014-03-15 18:40:00 Lock None None Thanks
  9. 2 Western Bulldogs 0.00 North Melbourne 0.00 Etihad 2014-03-30 16:40:00 Open None None 3 1 GWS Giants 15 Sydney 1.00 Skoda 2014-03-15 16:40:00 Open None None Thats an example of the data input.
  10. Their isn't any input, or post data, its a function to work out what round it is from the db so i can compare it to the current date. Is that what you mean by input data?
  11. I want to extract the MIN, MAX AND ROUND from the database. Can i get the result i want through making $count[][][] into a multiple array ? $rouCount = mysql_num_rows(mysql_query("SELECT MIN(Date) , MAX(Date) , `Round` FROM `GameRound`")); for ($i = 0; $i < $rouCount; $i++){ $count = mysql_fetch_row(mysql_query("SELECT MIN(Date) , MAX(Date) , `Round` FROM `GameRound`")); foreach ($count as $k => $lokk){ $a = $lokk; echo "Rounds $a[0] $a[1] $a[2]<br />"; } } Eventually I need it to display; Round 1 2014-03-14 2014-03-23 Round 2 2014-03-24 2014-03-29 Round 3 2014-04-14 2014-04-23 Round 4 2014-05-24 2014-05-29 atm i get; Rounds 2 0 1 Rounds 2 0 1 Rounds 1
  12. By doing this though causes 9 submit buttons instead of just the one though
  13. Perfect; mysql_query("SELECT `Round` FROM `GameRound` WHERE `Date` BETWEEN `` AND ``"); But i still need to work out which dates it will go between
  14. In the database i need to extract the following information; Date, And return which round of game it is. Im sure their is a much better way and easier way than how im going about this, so if someone could improve the way im going about it would be awesome. There are 23 rounds. In each round there are 9 games. $round1 = mysql_fetch_row(mysql_query("SELECT MIN(Date) , MAX(Date) FROM `gamerounds` WHERE `round` = '1'")); $rounddate = date(); round one dates are from say 14th of March to 23rd of March, than round 2 will run from 27th of March to 1 of April if (($round1[0] >= $rounddate) && ($round1[1] <= $rounddate)){ echo "Round 1"; }else{ echo "Not round 1"; } I could do this for all 23 than compare them in a If and else code and eventually return what round it is but it would be like a page and im sure time wasting time and there has to be a better way
  15. Thanks @Ch0cu3r This is the output i get; Round: 1 - Beton: Draw - Pwnow: 1 Round: 1 - Beton: - Pwnow: 2 Round: 1 - Beton: - Pwnow: 3 Round: 1 - Beton: - Pwnow: 4 Round: 1 - Beton: - Pwnow: 5 Round: 1 - Beton: - Pwnow: 6 Round: 1 - Beton: - Pwnow: 7 Round: 1 - Beton: - Pwnow: 8 Round: 1 - Beton: - Pwnow: 9 That makes perfect sense, how would extract that first line as that is the line i need. Its radio option as they can only select on option out of the 9 rounds
×
×
  • 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.