Jump to content

ninedoors

Members
  • Posts

    235
  • Joined

  • Last visited

Everything posted by ninedoors

  1. Try something like this: SELECT bets.name, Register.SNAME FROM Register LEFT JOIN bets ON bets.name = Register.SNAME WHERE bets.name IS NULL You will need a timestamp column in your bets table if you want to restrict it to a time frame.
  2. Make sure that $csv is an array. One way you can check it is: $test = is_array($csv) ? 'yes' : 'no'; echo $test; or you can print_r($csv);
  3. Hey Lake, So I used the code you posted and just cleaned it up a bit and added the part to get your win/loss dynamically. Make you add the style I put at the top of each script in your style you include in each page. Just saves you adding it to each td tag. These "should" get you at least your win/loss column working. The rest on the stuff you mentioned will be a lot more work and will take quite awhile to get it implemented but is definitely attainable. I have all these type stats setup on my mens hockey league website. It is still a work in progress and I have been at it for 5 years now!!! Here's my site. The main thing you should do is sit down and decide exactly what stats you want and might want to capture from your baseball games, now and for future. Even if you are entering something in the database now and aren't using it, it's good to have it there if you eventually decide you would like to track it. I will help you out if you want as I am actually about to start a baseball website for my men's league so it would be good to get the train moving. Nick [attachment deleted by admin]
  4. Do you have your error reporting turned on?
  5. Can you tell us where the image folder is? You have not closed your li tag replace the <br /> with </li>. Why in your img src do you start with "./", it seems odd to me cause I have never seen that before.
  6. I have put everything inside the one loop so there is no reason to collect them in the $file variable. You are also gettign the wrong image reference. Your code will give you <img src="./aircraft/aircraft/'$_GET['reg'].$i.'.jpg.jpg" /> Plus you don't close your li tag, you have a br tag instead.
  7. First off you are making $file a variable when I think you want to make it an array. You would need something like: while($i=0 $i < 9 $i++) $file[] = "aircraft/".$_GET['reg'].$i.".jpg"; Then you have a foreach loop. Why not do this inside the while loop? Like this maybe: while($i=0 $i < 9 $i++) echo '<li class="active"><img src="/aircraft/'.$_GET['reg'].$i.'.jpg" alt="Flowing Rock" style="width: auto; height: 70px; margin-left: -28.5px; display: block;" class="thumb" ></li>';
  8. Can you post your table structure?
  9. Hey Lake, I can definitely help you get this setup. So we don't have to do things twice, I just have a couple questions. [*]Do you have any tables setup in your database right now? [*]How are you going to go out entering the scores? Are you going to use an html form? [*]Are you going to be the only one entering the scores or will other people be doing it as well? [*]Do you have a schedule table setup already? If yes, what is it's structure? It take long for you to get this setup after we figure out these questions. Nick
  10. We will need your database structure to be able to help you add the win/loss field you are looking for. Just a note that adding this field breaks relational database law in that you have a column in a table that depends on another columns data. Meaning if a user inserted a score incorrectly say home 7 away 8 it would record a win for the home team. But if you realize your mistake and change the score to say home 7 away 7 you will have to have your program update the win/loss column as well. It doesn't sound like much but unless you are going to have 500, 000 games in the database I would calculate the result as you pull out the scores. I do this with my system that has around 2000 games in it and the query is pretty quick. Just my 2 cents. Nick
  11. After this can you echo $query so you know that $dob is not empty?
  12. If you are just looking to run php applications as standalone apps on any computer PHP Dock does this for you. I have used it and it works great.
  13. You should be getting an error because there is no column 'race' in the table you provided only 'race_id'. The insert shouldn't work at all at this point. Why do you having a closing html tag after the dob input?
  14. What happens when you have a user who has javascript disabled?
  15. Try this: <?php $host="localhost"; $username="xxxxx"; $password="xxxxxx"; $db_name="xxxxxxx"; $tbl_name="Shows"; // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name WHERE Month='April'and Year='2011' order by Day asc "; $result=mysql_query($sql); echo ' <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="400" border="1" cellspacing="0" cellpadding="3">'; if (mysql_num_rows($result) > 0) while($rows=mysql_fetch_array($result)) echo '<tr><td><span class="elevenbold">'.$rows['Day'].' '.$rows['Month'].'<br /><strong class="elevenboldblue">'.$rows['Song'].'</strong><br />'.$rows['Data'].'</span><br /><br /></td></tr>'; else echo '<tr><td>No Results</td></tr>'; echo ' </table> </td> </tr> </table>'; mysql_close(); ?> You should really look at your html structure as well as it is not laid out well and you will run into problem when you are trying to do more complex pages.
  16. Test for the $_POST['HA'] value and only add it if they have chosen home or away. Make your HA value for the all games selection equal all. <label><input type="radio" name="HA" value="all" id="HA_2" />All</label> <?php $sql = "SELECT * FROM your_db WHERE team_name = '$OPP'"; if ($_POST['HA'] != 'all') $sql .= " AND h_a = '$HA'"; mysql_query($sql); ?> This is untested but you can add in the proper query using your query with this logic.
  17. I use FPDF. There are a bunch of tutorials there you can use to print query results to a pdf. http://www.fpdf.org/
  18. If you post your code that you have so far someone might be able to help you add those conditions in. Do you have any code yet?
  19. Not that I know of but you can use a combination of array_intersect and array_diff to get your desired result. $final_array = array_diff($array2, array_intersect($array1, $array2)); Pretty sure that will work. Nick
  20. This is quite complicated if you value your time at all you should look at either of these two products. Great value for the dollar. I have only used Cometchat and not Arrowchat. Arrowchat looks very promising but it seems to be taking awhile to develop. Cometchat Arrowchat Nick
  21. You will have to modify this code to match what you want but this gives you a starting point anyway: <table width=600 align=center> <tr> <?php /* * This code owes an enormous debt to * http://www.barrychessclub.org.uk/berger2001.htm */ // Find out how many teams we want fixtures for. if (!isset($_GET['teams'])) { print get_form(); exit; } $teams = $_GET['teams']; $weeks = $_GET['weeks']; $startdate = $_GET['startdate']; // If odd number of teams add a "ghost". $ghost = false; if ($teams % 2 == 1) { $teams++; $ghost = true; } // Generate the fixtures using the cyclic algorithm. $totalRounds = $weeks; $matchesPerRound = $teams / 2; $rounds = array(); for ($i = 0; $i < $totalRounds; $i++) { $rounds[$i] = array(); } for ($round = 0; $round < $totalRounds; $round++) { for ($match = 0; $match < $matchesPerRound; $match++) { $home = ($round + $match) % ($teams - 1); $away = ($teams - 1 - $match + $round) % ($teams - 1); // Last team stays in the same place while the others // rotate around it. if ($match == 0) { $away = $teams - 1; } $rounds[$round][$match] = ($home + 1) . " v " . ($away + 1); } } /* // Interleave so that home and away games are fairly evenly dispersed. $interleaved = array(); for ($i = 0; $i < $totalRounds; $i++) { $interleaved[$i] = array(); } $evn = 0; $odd = ($teams / 2); for ($i = 0; $i < sizeof($rounds); $i++) { if ($i % 2 == 0) { $interleaved[$i] = $rounds[$evn++]; } else { $interleaved[$i] = $rounds[$odd++]; } } $rounds = $interleaved; // Last team can't be away for every game so flip them // to home on odd rounds. for ($round = 0; $round < sizeof($rounds); $round++) { if ($round % 2 == 1) { $rounds[$round][0] = flip($rounds[$round][0]); } } */ // Display the fixtures $matchdate = ''; for ($i = 0; $i < sizeof($rounds); $i++) { print "<p>Round " . ($i + 1) . "</p>\n"; foreach ($rounds[$i] as $r) { if($matchdate == ''){ $matchdate = $startdate; } if(strlen($r) == 6){ $team1 = $r[0]; $team2 = $r[4].$r[5]; echo $matchdate." ".$team1." vs ".$team2."<br>"; } else { $team1 = $r[0]; $team2 = $r[4]; echo $matchdate." ".$team1." vs ".$team2."<br>"; } } print "<br />"; $matchdate = date("Y-m-d", strtotime("$matchdate +1 week")); } print "<br />"; if ($ghost) { print "Matches against team " . $teams . " are byes."; } ?> </tr> </table>
  22. I use jpGraph to do all my graphing in php. It was pretty easy to get setup and I haven't had a problem with it. It also has a large number of people using it with a forum so you can normally find somone to help you that knows what they are talkig about if you run into a problem. Nick
  23. I am pulling out stats for a hockey league I run. What I would like to do it is to be able to pull all the data I need out of the multiple tables in one query without using sub queries. I have a table that holds all of the players in my hockey league. It holds the id number, team id and jersey number. I have a scoring table the has a line for each goal of assist that is scored with the player id and I have a games played table which has a row for each player that played in a given game. I am able to get the data out right now with one query but I have to use sub queries to do it. My query right now looks like this: ' SELECT s.id_member, s.team_id, sm.first_name, sm.last_name, t.alt_name, mt.jersey_id, d.division, SUM(IF(s.action_id = 1, 1, 0)) as g, SUM(IF(s.action_id = 2, 1, 0)) as a, SUM(IF(s.action_id = 2 OR s.action_id = 1, 1, 0)) as pts, SUM(IF(s.action_id = 1 AND s.gwg = 1, 1, 0)) as gwg, SUM(IF(s.action_id = 1 AND s.advantage > 0, 1, 0)) as ppg, SUM(IF(s.action_id = 1 AND s.advantage < 0, 1, 0)) as shg, ('.$pens_query.') as pims, ('.$games_query.') as gp, (SUM(IF(s.action_id = 2 OR s.action_id = 1, 1, 0))/('.$games_query.')) as pg FROM {db_prefix}osm_member_teams as mt LEFT JOIN {db_prefix}members as sm ON(mt.id_member = sm.id_member) LEFT JOIN {db_prefix}osm_scoring as s ON(mt.id_member = s.id_member AND mt.team_id = s.team_id) LEFT JOIN {db_prefix}osm_teams as t ON(mt.team_id = t.team_id) LEFT JOIN {db_prefix}osm_schedule as sc ON(s.game_id = sc.game_id) LEFT JOIN {db_prefix}osm_divisions as d ON(t.division = d.division_id) WHERE mt.position != {string:pos} AND mt.rostered = 1 AND sc.finished != 3' This works but the problem is that if a player hasn't recorded a point he won't show up in this query because he isn't in the scoring table(osm_scoring). What I need is that if any player has played a game then they show up in the query. Any help would be great. The games_query is a sub query to pull out the number of games played from that table. Same with the pims_query. Nick
  24. Try using brackets like: SELECT * FROM files WHERE (keywords RLIKE 'july' || keywords RLIKE '2008' || title RLIKE 'july' || title RLIKE '2008') && keywords NOT RLIKE 'membersonly'
×
×
  • 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.