Jump to content

jingo_man

New Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jingo_man's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks gizmola! Deleted and recreated using "any address", standard port 80, same doc root, and the server name I set to a new subdomain "sub.jingo.local" and created a manual DNS entry for this on the local DNS server to point to the server's IP. It now seems to be working. Didn't know about that could only pick one or the other with vhosts... Thanks
  2. I have apache2 installed, with webmin and it is currently running a couple of external domain sites (can't recall how I set these up before) For a new purpose, I need to setup a new site, and I am following a guide to do so, but the website creation part I expected to be able to do in webmin. However, nothing I try works... The server is on my home domain, with the servername jingoserver. There is a local DNS domain called "jingo.local". So far, I have tried: 1. Log into webmin 2. Go to Servers > Apache 3. Click "Create Virtual Host" tab 4. Enter following details 4.1 "Handle Connections" leave set to Any Address 4.2 Set the port to a new unused number, any non-standard web server port. 4.3 Set document root to appropriate directory 4.4 Tried leaving "Server name" as any of the following: blank, jingoserver, jingoserver.jingo.local, sub.jingoserver.jingo.local - NOTHING WORKS!!!! 4.5 "Add virtual server to file", leave at default of "New file under virtual servers directory" 4.6 Tried either to "Apply Changes" and / or "Restart apache" If I try to browse to the new site, nothing. errors. tailing the server logs, its not even hitting the /var/log/apache2/error.log.....! exactly the same with the access.log file. anyone help me please!!!!! thanks
  3. many thanks for the help gizmola. with the info you have provided, i can mark this question as solved. i made a slight alteration, but your base code was the guiding light i needed. cheers
  4. thanks gizmola yeah, suppose that is equally valid. essentially looping through it twice i guess, but 2nd loop is against a local array. so could pre-process on 1st loop when retrieving from database to include the position field. is the final line $rows[] = $row; the bit that reads everything from a given line into a particular array element? why is there nothing in the square braces? i.e. $rows[] can i add the additional "position" as a new element to the array while i am at it? i think the loop would need to check the the current score is the same as the previous row's score. if they are the same, then that position must be tied. or is my logic wrong? cheers
  5. how do i make a leaderboard that is capable of handling equal scores from a particular result? we use following points allocations: winner: 5pts second: 3pts third: 2pts fourth: 1pt however, if 2nd and 3rd have tied scores, i would like to combine their point allocations together and divide by 2, i.e. (3+2)/2=2.5points each. initial query for competition ranking: $q_lastcomp = "SELECT p.p_id, p.p_surname, p.p_forename, p.p_handicap, r.r_id, rp.rp_score, rp.rp_handicap, (rp.rp_score-rp.rp_handicap) as net_score "; $q_lastcomp .= "FROM dan_roundplayed rp, dan_round r, dan_player p "; $q_lastcomp .= "WHERE r.r_id = rp.rp_rid "; $q_lastcomp .= "AND p.p_id = rp.rp_pid "; $q_lastcomp .= "AND r.r_id = 6 "; $q_lastcomp .= "ORDER BY net_score"; $r_lastcomp = mysql_query($q_lastcomp) or die(mysql_error()); i then loop through this resultset in this order (top down), and do some more calculations to adjust the players golf handicaps based on these results too. basically, if there are 4 players, the winner has beaten 3 others, second has beaten 2 others, down to last place who has beaten no-one. the number of players you have beaten is multiplied by 10% of their handicap (not precisely this value, but something like it and makes easier to explain), then this adjustment is subtracted from the handicap to make a new handicap for the next comp. this works fine, so long as no-one is tied. but if 2nd and 3rd tie, then both players have effectively only beaten 1 other player (last placed). so i would want both to do "hcap - (1*(hcap*0.1))" for their handicap adjustment calculations. in my current code, even though they were tied, 2nd would have: "hcap - (2*(hcap*0.1))" 3rd would have: "hcap - (1*(hcap*0.1))" my current loop code is: $total_players = mysql_num_rows($r_lastcomp); $i = 1; while($row = mysql_fetch_array($r_lastcomp)){ echo "<br>"; $round_hcap = round($row[p_handicap]); SWITCH ($round_hcap){ CASE $round_hcap >= 0 AND $round_hcap <= 19: $multiplier = 0.1; break; CASE $round_hcap >= 20 AND $round_hcap <= 29: $multiplier = 0.2; break; CASE $round_hcap >= 30 AND $round_hcap <= 39: $multiplier = 0.3; break; CASE $round_hcap >= 40 AND $round_hcap <= 49: $multiplier = 0.4; break; } $hcap_reduce = ($total_players-$i)*$multiplier; $new_hcap = $row[p_handicap]-(($total_players-$i)*$multiplier); $sqlstr = "INSERT INTO dan_handicap VALUES (". $row[p_id]. ",". $row[r_id]. ",". $row[p_handicap]. ",". $i. ","; $sqlstr .= $total_players. ",". $hcap_reduce. ",". $new_hcap. ");"; $sqlstr2 = "UPDATE dan_player SET p_handicap = ". $new_hcap. " WHERE p_id = ". $row[p_id]. ";"; echo $sqlstr. "<br>"; echo $sqlstr2. "<br>"; $i++; } can anyone help with this please? my initial thoughts are i am going to need a drastic adjustment to the initial query add in position number in the comp, i.e. this would produce posn | name | score 1 | winner | 10 2 | tied 2nd | 8 2 | tied 2nd | 8 4 | last place | 5 the second section of code could then use this "position number" for the multiplier part of the calculations. apologies for the length of the post, but this covers the whole requirements. regards jingo_man
  6. thanks for the heads up, wildbug. using your code as a base, and searching around it, i amended it slightly to work with a more advanced array. i am now intending to create the compare() function to accept an extra parameter so i can check other values. the function is: function compare($a, $b) { if ($a == $b) { return 0; } return ($a[25] < $b[25]) ? -1 : 1; } the array sorting is called with "ucase($array,"compare"); ----- i would like to change it so the number 25 (column no of the array) can be changed. thought i could add a 3rd parameter to compare() and specify which column i am after, but i cant interpret how $a and $b get their values - "compare" isnt a typical function call with parameters... thanks again... jingo_man
  7. hi, i have read the documentation around the array_multisort() function. this however seems to sort horizontally, where as i need to do so vertically. does anyone know how to get around this? for example, array_multisort() will work with this array: (0,0) = A (0,1) = B (0,2) = C (0,3) = D (1,0) = E (1,1) = F (1,2) = G (1,3) = H so it structurally looks like: A B C D E F G H my array, however is: Hole1, Score1 Hole2, Score2 and i need to sort the "Score" column... many thanks for any help. jingo_man
×
×
  • 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.