Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. Makes sense! I'll play around with it today. (I'll likely be back.) That will likely help me with the scheduling query you helped me with, as there will definitely be some archiving there as well.
  2. Querying data for Notes that will have new instances each season (November 1-March 31), and as each season passes by I want the information produced to reflect the information at the time the query was made. (This is for scouting) Columns are... id schoolID (copied from another table) players season So for example, I want each time I use this query for a Note from November 1, 2019 through March 31, 2020, to use rows where season = '19-20', and as we move into next season '20-21' I'll create new instances for each school I use. The previous seasons of information will be archived but still viewable, so when someone goes back to read information from 2019-2020 season, I want the 19-20 rows to still be showing. I'm thinking this through as I'm typing... As I'm creating these Notes, they do leave a post date yyyy-mm-dd, I'd assume I could use that as a reference point.
  3. Never mind. I had a mismatched .class between the php file and the CSS file.
  4. I'm using Flexbox, and it's mostly working very well, but I added an extra layer to the output. I'm effectively creating two Flexboxes, and the second Flexbox just starts right after the first one ends. It should have a head Mr. Basketball in the MIBFL followed by four names in four classes. Then it should have Indiana All-stars in the MIBFL followed by many name in many classes. http://metroindybasketball.com Is there CSS code for it? If not, here is the code in case I can reorder the layout. $query = "SELECT * FROM a_allstars WHERE level > 0 ORDER BY level desc, grad desc,nameLast"; $results = mysqli_query($con,$query); echo mysqli_error($con); $level = array ( // Figure out what they did after MIBFL 0 => 'D1 Players', 1 => 'Indiana All-stars', 2 => 'Mr. Basketballs' ); $currentGrade = false; $currentLevel = false; while($line = mysqli_fetch_assoc($results)) { // Are they Mr. Basketball or an All-star if($currentLevel != $line['level']) { if($currentLevel != false) { // this closes the previous DIV echo '</div>'; } // Header for next section - Mr. Basketball, Indiana All-star echo '<div class="header"><h2>' . $level[$line['level']] . ' in the MIBFL</h2></div>'; echo '<div class="allstar-container">'; // starts flexbox for each change of Level $currentLevel = $line['level']; } // Now we check their grade if($currentGrade != $line['grad']) { // Checking their grade if($currentGrade != false) { echo '</div>'; // end previous class' div - doesnt trigger end of first class } //Grade has changed, display Grade header echo '<div class="grad-item">'; // start new class' div echo '<div><h3>Class of 20' . $line['grad'] . '</h3></div>'; $currentGrade = $line['grad']; } // end currentGrade main loop echo '<div class="player_card">'; echo '<div class="name"><b>' . $line['nameFirst'] . ' ' . $line['nameLast'] . '</b></div>'; echo '<div class="schools">'. $line['schoolHigh'] . ' :: ' . $line['college'] . '</div>'; echo '</div>'; } // closes the main loop echo '</div>'; // end final grad-item div echo '</div>'; // closes allstar-container
  5. Here is my other question. If I want to list the User names in the order of how many topics they have started, I likely have to use count() in the query, right? I didn't wrap my head around the syntax of that.
  6. Never mind...figured that part out.... Print the first half of what I need (the User Name) in the main IF loop, then add the count after there is a change but before the User name and count are reset. $query = "select thread_id,user_id,username from ( select * from xf_post order by post_id ) x group by thread_id order by username,thread_id"; $results = mysqli_query($con,$query); echo mysqli_error($con); $currentID= false; while($line = mysqli_fetch_assoc($results)) { if ($currentID != $line['user_id']) { if ($currentID != false) { echo $c . '</div>'; $c=0; } $currentID = $line['user_id']; echo '<div>' . $line['username'] . ', '; $c++; } else { $c++; } }
  7. I'm trying to get a count of how many topics someone starts in a forum. I use XenForo, and they only count Posts, but I can order Posts by post_id and group those posts by thread_id to determine the initial instance of that topic. The problem I'm having is output. I'm getting the right User info, but the output is offset by one row: User 1 | 0 topics (because $c=0) User 2 | 128 topics (but those are User 1's #) User 3 | 0 topics (but those are User 2's #) User 4 | 141 topics (but those are User 3's #) etc I realize as I play through the logic of the code, it's printing in that order. I can't seem to get the right order. I've tried various ways, with a couple of extra IF statements in there too. $query = "select thread_id,user_id,username from ( select * from xf_post order by post_id ) x group by thread_id order by username,thread_id"; $results = mysqli_query($con,$query); echo mysqli_error($con); $c=0; $currentID = false; while($line = mysqli_fetch_assoc($results)) { if ($currentID != $line['user_id']) { echo '<div>' . $line['username'] . ', ' . $c; $currentID = $line['user_id']; $c=0; } else { $c++; } }
  8. For those looking for the same thing later, CSS: Flexbox is working very well for my needs. https://css-tricks.com/snippets/css/a-guide-to-flexbox/ Link to content https://metroindybasketball.com/#1562069244415-0777ef53-6ff6
  9. OK...upon further review...I might have found the answer. Maybe more of a CSS issue, output into DIV's then floating each DIV as I need them. Would that be the best way?
  10. I'm wanting to output data into two columns. I've searched for this in a few places. A vast majority of the search results deal with getting data from multiple columns, and the the ones that deal with what I'm looking for don't really have any solutions attached to them. I'm not fully worried about the columns being equal length. The data is broken up into a certain number of rows in a given year. I have about 12 years, probably 6-8 rows per year. I just don't know how to get it into different columns. I don't care if it goes left to right then down or down then left to right. If there has been a solution to that here already, feel free to point me in that direction. Point me in any applicable direction, I'd fine with. I just can't locate anywhere what trigger would cause that.
  11. Never mind. Figured that last part out. Thank you everyone!
  12. Last part of this now: I really mean for that form to be a jump menu, so when they make a choice it automatically redirects the User to a new page. Where do I put the javascript? On the Functions file, the main file or its own file and reference it?
  13. I was trying everything. I saw someone who had code working that had parenthesis. It didn't make a difference with my problem, and I just never deleted them.
  14. That was the final straw with it. I tried it in each place, in the functions file and on the main file, but I didn't have it in both places at the same time.
  15. As I understand it, if I put $con in there, it will only show errors related to $con. There aren't any errors related to $con. It's the same connection I'm using throughout my site, not to mention what is used to populate the rest of the page that is linked. I'd like to know why it's not working within the confines of a Function. If I give it its own file and add it as an include, it works. I'd just like to be more efficient in my code.
  16. echo '<div class="jump_menu">' . sectional_select() . '</div>';
  17. I like to solve as much here so others can learn. If you want to PM after this, that'll be fine, but here is what you're looking for... include (ABSPATH ."resources/con.php"); function sectional_select($con) { $query_sect = ("SELECT * FROM a_sectionals_bkb"); $results_sect = mysqli_query($con,$query_sect); echo mysqli_error($results_sect); echo '<div class="sectional_select">'; echo '<form name="Sectionals">'; echo '<select name="sectional" size="3" onChange="go()">'; echo '<option value="NULL">Select Sectional</option>'; while($row_sect = mysqli_fetch_assoc($results_sect)) { $row_sectionals = $row_sect['id']; echo '<option value="/season-preview/19-20/sectional1920/?sectional='. $row_sectionals .'">Sectional '. $row_sectionals .'</option>'; } echo '</select>'; // End Sectional Select echo '</div>'; // End of Sectional Select Function } Here is con.php $con = mysqli_connect("localhost","username","password", "table"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
  18. I've been reading up on that, but I get a different error when I add it to the function. function sectional_select($con) { => line 5 $query_sect = ("SELECT * FROM a_sectionals_bkb"); $results_sect = mysqli_query($con,$query_sect); => line 9 echo mysqli_error($results_sect); => line 11 echo '<div class="sectional_select">'; echo '<form name="Sectionals">'; echo '<select name="sectional" size="3" onChange="go()">'; echo '<option value="NULL">Select Sectional</option>'; while($row_sect = mysqli_fetch_assoc($results_sect)) { $row_sectionals = $row_sect['id']; echo '<option value="/season-preview/19-20/sectional1920/?sectional='. $row_sectionals .'">Sectional '. $row_sectionals .'</option>'; } echo '</select>'; // End Sectional Select echo '</div>'; // End of Sectional Select Function } Produces these errors: Warning: Missing argument 1 for sectional_select(), called in /home2/csi/public_html/resources/preview1920/sectional-header.php on line 22 and defined in /home2/csi/public_html/resources/preview1920/functions.php on line 5 Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home2/csi/public_html/resources/preview1920/functions.php on line 9 Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home2/csi/public_html/resources/preview1920/functions.php on line 11
  19. It has something to do with being in a Function, as best as I can tell.
  20. I had the above wrapped in a function. When I remove the function aspect of it, the query works, except the $results = mysqli_query($con,$query); function sectional_select() { $query = "SELECT id FROM a_sectionals_bkb"; $results = mysqli_query($con,$query); echo mysqli_error($results); echo '<div class="sectional_select">'; echo '<form name="Sectionals">'; echo '<select name="sectional" size="3" onChange="go()">'; echo '<option value="NULL">Select Sectional</option>'; while($row = mysqli_fetch_assoc($results)) { echo '<option value="/season-preview/19-20/sectional1920/?sectional='. $row['id'] .'">Sectional '. $row['id'].'</option>'; } echo '</select>'; // End Sectional Select echo '</div>'; // End of Sectional Select Function }
  21. The connection parameter is there. I just didn't copy it over, and this query is working just fine... $query = "SELECT * FROM a_coach WHERE email IS NULL"; $results = mysqli_query($con,$query); $num_rows = mysqli_num_rows($results); echo mysqli_error($con);
  22. I've actually ported the query below from something else I've done that works. Not sure what I'm missing. Here are the errors I'm getting: $query = "SELECT id FROM a_sectionals_bkb"; $results = mysqli_query($con,$query); //=> Line 9 echo mysqli_error($results); //=> Line 11 echo '<div class="sectional_select">'; echo '<form name="Sectionals">'; echo '<select name="sectional" size="3" onChange="go()">'; echo '<option value="NULL">Select Sectional</option>'; while($row = mysqli_fetch_assoc($results)) { echo '<option value="/season-preview/19-20/sectional1920/?sectional='. $row['id'] .'">Sectional '. $row['id'].'</option>'; } echo '</select>'; // End Sectional Select echo '</div>'; // End of Sectional Select Function
  23. There was a light plugin via WordPress that took care of it. Not sure it "solves" the problem, but then again, it could be a WordPress/theme issue. As long as it works, I'm good.
  24. Not as intended, and I had tried that earlier. Sticky is supposed to keep the DIV relative until the "Top" is reached, then stick there. Maybe it's a theme issue too that I'm using for WordPress, as it hides behind the main navigation until that is off screen. I need it visible the whole time. I thought I was doing well to find the "main" issue that keeps "sticky" from working (overflow: hidden;), but I don't have that issue.
  25. BTW...the DIV in question is in red, and I'm trying to get it to stick to the top of the browser as the User scrolls down.
×
×
  • 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.