Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. (I’m just using SELECT * right now because I’m just now starting this project and don’t want to have to change that line each time I add or subtract a column.) I removed the aliases in the output, and it worked, but I don’t really know why. So thank you! In setting up the aliases, I thought I would be told the opposite, that I wasn’t using the aliases in the query or the rest of the output. I don’t have any repetitive column names. Why doesn’t the query have an idea which table each index of each row came from?
  2. This is my query now: $query = "SELECT * FROM a_schools as s join a_coach as c on c.schoolID = s.ID WHERE s.sectional='" . $sectional ."' AND s.school='" . $school . "' "; Still not printing the coach’s name
  3. This is sort of combining the other topic (coaches/schools) that you’re helping me with. I have a schools table and a coach table, and I’m trying to print the school name, followed by the head coach’s name. Right now, it’s not printing the coach’s name. // Getting variables out of the URL $sectional = $_GET['sectional']; $school = $_GET['school']; $school_lower = strtolower($school); // Query $query = "SELECT * FROM a_schools as s join a_coach as c WHERE sectional='" . $sectional ."' AND school='" . $school . "' AND c.schoolID = s.ID "; $results = mysqli_query($con,$query); echo mysqli_error($con); while($row = mysqli_fetch_assoc($results)) { echo '<img src="/resources/preview1920/images/'. $school_lower .'/'. $school_lower .'-ad-1.png">'; echo '<div class="wrapper">'; echo '<div class="school_info">'; echo '<img src="/images/schoolLogo/'.$school.'.png">'; echo '<div class="school_name">' . $row['school'] . ' ' . $row['nickname'] .'</div>'; echo '<div>Head Coach: ' . $row['c.coachFirst'] . ' ' . $row['c.coachLast'] .'</div>';
  4. But each new school is a new instance, and I would want to calculate his overall record and record at the current school. (I realize this will take some serious back filling eventually.) So if Coach A coached at School A for ten years, (to me) that would be one row, then as he changed jobs, I'd have to have Coach A at School B.
  5. After each season, as a coach changes jobs, I would add an instance/row to the coaching_record table with his new school of record?
  6. Passing variable via the URL: https://www.courtsideindiana.com/season-preview/19-20/sectional1920/?sectional=8&amp;school=Carmel Sectional = 8 School = Carmel Before I added the &school=Carmel, it was working, just echoing the total list of schools in the table. $sectional = $_GET['sectional']; $school = $_GET['school']; echo $school; // Query $query = "SELECT * FROM a_schools WHERE sectional=".$sectional." AND school=" . $school .""; $results = mysqli_query($con,$query); echo mysqli_error($con); while($row = mysqli_fetch_assoc($results)) { echo $row['school'] . '<br>'; }
  7. The Sectional is the first round of our state tournament, so season preview information will be grouped by sectionals. I won't be duplicating any data. I may not even separate the city in the final version of this. My last decision will likely be how to handle the coach part because I want to compile their yearly records going forward and *might* even back fill it as time goes on. I'm assuming I should not have the coach as part of the school part. Right? I should have a coaches table, then designate which team they coach. However, would I be able to automate the recording of the record from season to season, even as the coaches change teams?
  8. That's just an application. I'm using a MySql database.
  9. Upon further review, I can change the storage engine for each table in Sequel Pro. I can now set up Relations between tables. (Not sure what that means yet.) Do you only columns with integers or numeric values show up as Relationship options? UPDATE: Can not add Relation. Can not add foreign key constraint.
  10. I'm with you on that, and the list with ID#'s can be viewable while entering game data. Either way, we're going to have to scroll to match data. I suppose I could set up a form, which would then check to duplicates. I use Sequel Pro to view and edit my databases, and it's been great over the years. It has a Relations tab in table view. However, it won't allow me to create Relations for the tables. Something to do with the database engine. It would be nice if there was an application that allowed me to set up a Relation between tables, then as school names are type, creates auto-complete options.
  11. We'll be typing the games directly into the database.
  12. As for the date, probably not knowing enough about the date function, thinking it would be easier when it came time to printing, since I want to print month abbreviations.
  13. My only concern for using School ID vs. school names is making it difficult for data entry, always having to look up the school ID to input. Why extend it to city and conference? Keep in mind, lots of smaller schools aren't named after their city because they're consolidations and not repeated instances. As for the date, probably not knowing enough about the date functions.
  14. There are approximately 420 school teams in our state for basketball, and I'm producing schedules for each team. I'm looking for recommendations on how to set up the data tables. I'm just getting started on the structure, and I'm under no pressure for it to go live until early November. I have a Schools data table. Each schools has their own ID. I have a Games data table. Each game will have its own ID. Each game will have a column for the home team and a column for the away team (other columns too). For home team and away team, should I type the school name or the associated School ID? Right now I have it set up to use the School ID. Games Table: Schools Table: Is that pretty SOP?
  15. I went back to this query: SELECT * FROM a_players WHERE team=' .$team.' ORDER BY nameLast ASC'; Everything appears to be working. Does anyone have any idea why adding %26 would change the results of what even gets noticed?
  16. (Thank you for unlocking the topic.) I tried the global GET: it produced Array ( [nameFull] => Evan-Borgman ) Interestingly, I read something somewhere that said to add %26 (numerical ampersand value), and this is what I got: Array ( [nameFull] => Evan-Borgman [&team] => 16 ) So I changed the top of the code to: $team = $_GET['&team']; echo $team; And it produced the correct 16. However, it's still not taking $team = 16 and using it in the query.
  17. I made the change. It's not echo $team, so it's not GETting anything. That's the perplexing part. No matter how I use team=16, it doesn't pass the value. I have even tried it as the only value.
  18. When I echo $playerName it show (in the case of this page) Evan-Borgman. I have flipped flopped the GET's. $_GET('nameFull') always works, $_GET('team') never works. I keep looking to make sure it isn't some syntax error. @chriscloyd, I'll have to try that out after a meeting. I wanted to answer the question of what shows up when I echo nameFull. I'll have to keep the SELECT * though because I'll be adding more information to the printout. That was just a quick port from another instance where it was just a list of names. Does it matter that I have two GETs on the page? My instinct says no, and I did flip flop the GET's (instances) on my page with the same result. Here is the side that is working: $playerName = $_GET['nameFull']; //echo $playerName; $query = 'SELECT * FROM a_players ORDER BY uniform ASC'; $results = mysql_query($query); while($line = mysql_fetch_assoc($results)) { $nFirst = $line['nameFirst']; $nLast = $line['nameLast']; $nameFull = "{$nLast}{$nFirst}"; if ($playerName == $line['nameFirst'].'-'.$line['nameLast']) { echo ' <div class="profile">'; echo '<div class="profileName">' .$line['nameFirst'] . ' ' .$line['nameLast'] . '</div>'; echo '<div>'. $line['feet'] . '\'' . $line['inches'] . '", '; if ($line['position'] == 'PG') {echo 'Point Guard';} elseif ($line['position'] == 'SG') {echo 'Shooting Guard';} elseif ($line['position'] == 'SF') {echo 'Small Forward';} elseif ($line['position'] == 'PF') {echo 'Power Forward';} elseif ($line['position'] == 'C') {echo 'Center';} echo '</div>'; //echo '<img src="http://spieceindyheat.com/2015/images/player_boards/hardwoodBW/' . strtolower($nLast) .'' . $line['nameFirst'] . '.png" width="250">'; echo '<div>Class of 20' . $line['team']. '</div>'; echo '<div>'; if (!isset($line['city'])) { echo $line['school'] .' HS'; } else { echo $line['city'] . ' ('. $line['school'] . ')'; } echo '</div><!--more-->'; if ($line['team'] < 19) { echo '<div>Coach ' . $line['coachSchool'].'</div>'; } // echo $line['schoolAddress'] . '<br>'; // echo $line['schoolCity'] . ' IN, ' . $line['schoolZip'] . '<br>'; // echo $line['schoolPhone']; echo '</div> <hr class="profile">'; } }
  19. Would it make any difference that the second variable is a number? I tested it by removing the first variable, 'nameFull', and 'team' alone doesn't produce any results. So under no circumstance does it pass the team number to the second page, even though it clearly passes the team number 16 to the second page's URL.
  20. I have two areas drawing information my database based on the variables passed from a Roster Page to a Profile Page. On the Profile Page, there are two queries, one in main/body and one in the sidebar. The main/body area is working. The sidebar isn't. Below the: echo $team produces nothing. Here is the page in question: http://eg10basketball.com/playerinfo/?nameFull=Evan-Borgman&team=16 Here is the error I'm getting: $team = $_GET['team']; echo $team; $query = 'SELECT * FROM a_players WHERE team= '. $team .' ORDER BY nameLast ASC'; $results = mysql_query($query); $count = 0; while($line = mysql_fetch_assoc($results)) { $count = $count+1; echo '<div><a href="http://eg10basketball.com/playerinfo?nameFull=' . $line['nameFirst'] . '-' . $line['nameLast'] . '">'. $line['nameFirst'] . ' ' . $line['nameLast'] .'</a><br></div>'; }
  21. I can't get any of it in there without getting the error. Which functions page? The one in my theme or the one in wp-includes?
  22. Whenever I put that in functions.php, I get an error. Is it because I haven't done the second part?
  23. I'm creating this URL to pass variables to use from one Page to another: http://eg10basketball.com/playerinfo/?nameFull=Evan-Borgman&team=16 My WP site is seeing the first variable but not the second. After some searching I've found this suggestion, but it's not working for me: function add_query_vars_filter( $vars ) { $vars[] = "nameFull"; $vars[] = "team"; return $vars; } add_filter( 'query_vars', 'add_query_vars_filter' ); I tried putting this in the wp-includes/functions.php file of the, but ended up with a fatal error. I have since added it to my theme's functions.php file. There isn't an error, but it doesn't yield recognition of my second variable.
  24. That would catch most of them from one season to the next and likely eliminate anyone re-registering simply to make a payment if they didn't pay the first time. I'll try that for next year. Thank you. For now, anyone have any help for my query for my issue now?
×
×
  • 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.