Jump to content

Jim R

Members
  • Content Count

    686
  • Joined

  • Last visited

  • Days Won

    1

Jim R last won the day on July 26 2018

Jim R had the most liked content!

Community Reputation

1 Neutral

About Jim R

  • Rank
    Prolific Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Never mind. I had a mismatched .class between the php file and the CSS file.
  2. 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
  3. 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.
  4. 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++; } }
  5. 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++; } }
  6. 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
  7. 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?
  8. 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.
  9. Never mind. Figured that last part out. Thank you everyone!
  10. 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?
  11. 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.
  12. 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.
  13. 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.
  14. echo '<div class="jump_menu">' . sectional_select() . '</div>';
  15. 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(); }
×
×
  • 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.