Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. Because it's not. Lafayette Jefferson goes by Lafayette Jefferson High School. McCutcheon High School in Lafayette just goes by McCutcheon. Harrison High School in West Lafayette goes by Harrison High School. There is also Harrison High School in Evansville. There are nine schools in Indiana with Central as their name or in their name. There are other instances of this with other words--North, South, East, West, Christian, Catholic, Prep, etc.
  2. There is another part of the site where I want them to be distinctly separate.
  3. Filling both columns won't change anything. The city name isn't always relevant to how the school is referred to, but I do use the city name in other areas. I'll look up coalesce. Thanks.
  4. Yes it does matters. It matters to my Users, and it matters to those who want to see their school represented as the school is named. It matters to me.
  5. Can I do that via a function on the same file and referring to the function?
  6. I have three columns -- Use | City | School In cities where the school is just the name of the city, city is NULL. In cities that have multiple schools or the name of the school isn't *just* the name of the city I fill in the city name, but the name of the city isn't always incorporated into the school name. https://www.courtsideindiana.com/tag/mccutcheon/ On the right hand side of the page, it prints: Kokomo Logansport Marion Lafayette Jefferson McCutcheon Harrison It should read: Harrison Kokomo Lafayette Jefferson Logansport Marion McCutcheon (I have a trigger that determines when to print the city into the name and when not to.) The data table columns look like this (I struck out the city names not being used in printing the school name) Use | City | School 0 | NULL | Kokomo 0 | NULL | Logansport 0 | NULL | Marion 1 | Lafayette | Jefferson 0 | Lafayette | McCutcheon 0 | West Lafayette | Harrison The query is actually looking for the teams in the same Sectional (bsect) as the featured school -- in the linked case above, McCutcheon. $query = "SELECT use,city,school from a_schools as s1 LEFT JOIN a_schools as s2 ON s1.bsect = s2.bsect WHERE '" . $query_school . "' = CONCAT(s1.city,' ',s1.school) || '" . $query_school . "' = s1.school ORDER BY concat(s2.city,s2.school) asc"; (The WHERE has to look for examples where it's just the school name OR examples where the city is incorporated in the school name.) In a lot of instances, how I have this ordered works, which is why I have it that way, but this is definitely an example where it doesn't. Do I wait to sort after the query?
  7. Yes, it's connecting the function to the database, appearing in every function, but what was causing my issue at hand was me creating an endless loop and it ending at my server connections limit. I tried referring to a global connection, but I didn't get it to work. I'm closing every connection at the end of each function.
  8. Never mind. I figured it out. I had team_profile() in the team_profile function. It was creating an endless loop that was only halted by the connections error. I'm an idiot!
  9. This function determines if we have a Player's name or Team function team_or_player () { /// /// /// Determine if it's a player or a team or player profile /// /// This function is located in the /plugins/td-standard-pack/newspaper/tag.php /// /// // tag or search if (function_exists( 'single_tag_title' )) { $tag = single_tag_title("", false); } else { $tag = get_search_query(); } include(ABSPATH ."resources/con.php"); $query = "SELECT nameFirst,nameLast,city,school,position,grade FROM a_players WHERE CONCAT(nameFirst,' ', nameLast) = '".$tag."'"; $results = mysqli_query($con,$query); echo mysqli_error($con); if($line = mysqli_fetch_assoc($results)) { $name = "{$line['nameFirst']} {$line['nameLast']}"; echo $name; // Just to make sure it's getting the intendeded result player_profile(); } else { echo 'Team'; // Just to make sure we're getting passed to Team team_profile(); } /// ////// End Team or Player /// mysqli_close($con); } Passing it to the Player Profile works just fine. Passing it to the Team Profile (code in the OP) works, but the query produces 23 instances.
  10. I think the 23 instances of Brownsburg and Team1 is what is triggering the error. When I remove the query and establish and echo $tag it works fine. I don't see anything in the query that would lead to 23 instances of Brownsburg and Team1.
  11. On one of my sites, I have created a number of custom functions to put into my WordPress installation. Suddenly I'm getting a max user connection error. Here is the page it's showing: https://www.courtsideindiana.com/tag/brownsburg/ The right hand side of the page are two of my custom functions. The content above Tag: Brownsburg is a custom function, which is supposed to just have test content. The odd behavior also is there should just be one Brownsburg listed and one Team1 (not 23). I have tried to close each connection mysqli_close($con); If it would matter, the query is below: function team_profile() { // // ////////// begin team profile // // include(ABSPATH ."resources/con.php"); // Tag or Search if (function_exists( 'single_tag_title' )) { $tag = single_tag_title("", false); } else { $tag = get_search_query(); } echo $tag .'<br>'; // just to test $query = "SELECT * FROM a_schools WHERE (school = '" .$tag . "' || concat(city,' ',school) = '".$tag."')"; // End tag vs search term, finish the query $results = mysqli_query($con,$query); echo mysqli_error($con); if($line = mysqli_fetch_assoc($results)) { $school = "{$line['city']} {$line['school']}"; if($line['school'] == $tag) { team_profile(); echo 'Team 1'; // just to test } else { team_profile(); echo 'Team 2'; // just to test } } mysqli_close($con); }
  12. I should've said, not every row has that. The ones which don't are either NULL or a different city altogether.
  13. Here are my examples: City | School Bloomington | Bloomington North Columbus | Columbus East Fort Wayne | Fort Wayne Bishop Dwenger I have several of these. I want to remove from School what already is in City.
  14. I've tried this, but it doesn't change the result. I'm not really sure the order has much do with it, unless it's inside a loop or directly passing information along. I've echoed it within the function. I've put it after the ?>. I posted that above in the OP. No matter I've put it, the CSS works, but it creates header errors. I have other PHP files with CSS links above the <?php without these errors. I'm wondering if it's a function issue. What I'm working on at the moment, it worked fine until I tucked it into a function vs. using INCLUDE. I was surprised echoing it in the PHP code triggered the error.
  15. I figured the later, since there was an error. Back to the original question, maybe a little more specific. How to link the .css file without creating the header error?
  16. I'm trying to link think a .php file full of functions to the following stylesheet I have it above the <?php tag. I have tried echoing it inside the <?php and ?>, but it produces the same error. Getting this error:
  17. It didn't include the Players table. Unless I missed something, it was just joining seasons and notes.
  18. Table structure isn’t at issue, other than adding a Seasons table. Can we please just focus on the date stamps and seasons?
  19. I copy the team ID from the teams table over to the player_previews table as I need them over from the team tables, and the WordPress shortcode I created matches it.
  20. I'm not drawing from my own games/fixture table. There are several games on each preview, and I'm just using the table to put out a consistent list of players for the team I write briefly about. I'm getting what I need/want right now other than matching date stamps based on a the applicable season. Notes table: date stamp Players table: date stamp Seasons table: start_date, end_date
  21. Here is a sample Note/preview: That's what is what the reader sees. Here is what I type: Then that team number in the shortcode is run the query above to produce the list. I now want to add a time element to it, based on the timestamp of the Note posting so as the seasons change, it accesses new instances each year. I only need to focus on the date stamp of the Note/preview with the date stamp in my Players table and make sure they come from the same Season (range of dates).
  22. No...these are preview notes, where I write about the team. I created a shortcode in WordPress to access the data for each team. I want to make sure each instance/row stays true to its season as time marches on. I'm just in need of the time/season issue.
  23. So I need to refer to the timestamp of the Note, then match it to the timestamp of entry into the Players (a_game_preview_players) table, relative to the date range provided for reach season. This is what I had before getting to this timestamp issue. $query = "SELECT * FROM a_game_preview_players where teamID = '" . $team . "'"; $results = mysqli_query($con,$query); echo mysqli_error($con); while($row = mysqli_fetch_assoc($results)) { return '<b>' . $row['school'] . '</b><br/>' . $row['players']; }
  24. It's just a CSV list for each team I've been typing out as I need it. It's not a comprehensive list of players. Out of 410 schools, there will be about 30 of them I write about repeatedly. (Side note: I do have a table for players, but it's way more extensive than my needs for the above, and it would require me to distinguish which ones to list. If I get to a point where I find that would be more efficient from a work flow perspective, I'd likely be able to adapt what we're doing here to access the main players table. I just really needed help on how to reference a date range without hard coding it into the query or having to note the season each time I access the query.)
  25. Question first: I'll have a Notes table, which timestamps when the note is made. Then i'll have this Players table (columns noted above), which I will have timestamp when each entry is made. Then I'll have a Seasons table, defining each season. So I will query the Notes and Players table, relevant to the date range set up by the Seasons table, right?
×
×
  • 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.