Jump to content

Jim R

Members
  • Posts

    943
  • Joined

  • Last visited

  • Days Won

    1

Jim R last won the day on July 26 2018

Jim R had the most liked content!

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

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

Jim R's Achievements

Prolific Member

Prolific Member (5/5)

1

Reputation

5

Community Answers

  1. In my database, I have multiple entries from people who register to play basketball in an event. The additional entries are from about a dozen or so people who didn't pay when they initially registered and didn't see the link that takes them directly to pay without registering. In using SELECT DISTINCT, my minor dilemma is one time they might type in for their school, ex: Lebanon, the first time, but Lebanon High School the second time. Columns: id | nameFirst | nameLast | school So if this is my query: select distinct nameFirst,nameLast,school from fallLeague2021 where player_coach ='player' order by nameLast,nameFirst ...is there a way using SELECT DISTINCT to just check the first and last names, then going about business as usual on the other columns? it's a minor issue as currently situated, because it's only about 12 or so entries out of 400, but it would nice if there was an elegant solution using SELECT DISTINCT.
  2. It was styles.css not style.css 😐 The whole time I was wondering if I was missing a step or if I was implementing it correctly inside the other function. It's working now without putting anything inside the other function(s). As I was searching for results, no one ever said how to apply wp_enqueue to other functions, and no one ever said it didn't have to be. Meanwhile, the whole time my file name didn't match the referenced URL. I always appreciate the time people put into responding, so thank you. Building my first full plugin, rather than just injecting my own code, so I'm learning some new tricks.
  3. When I echo plugin_dir_url( __FILE__ ); it produces the correct pathway to my plugin folder, but it doesn't show style.css in the echo.
  4. Here is the full code so far: (Right now I have /style.css vs. style.css) function wpse_load_plugin_css() { $plugin_url = plugin_dir_url( __FILE__ ); wp_enqueue_style( 'style', $plugin_url . '/style.css' ); } add_action( 'wp_enqueue_scripts', 'wpse_load_plugin_css' ); // This gives us uniformity on how the player's name is displayed and formatted function player_name ($nameFirst,$nameLast,$pid) { echo '<span class="full-name"><a href="/tag/'. strtolower(str_replace("'",'',$nameFirst)) . '-' . strtolower(str_replace("'",'',$nameLast)) .'"><span class="fname">'. $nameFirst . '</span><span class="lname"> ' . $nameLast .'</span></a></span>'; } function test() { global $con; wp_enqueue_style('style'); $query ="SELECT *, GROUP_CONCAT(i.industryName) as industry FROM pm_athlete a JOIN pm_athlete_interest ai ON a.id = ai.athleteID JOIN pm_industry i ON i.id = ai.industryID "; echo '<div class="profile">'; $results = mysqli_query($con,$query); while($line = mysqli_fetch_assoc($results)) { $nameFirst = $line['athleteFirst']; $nameLast = $line['athleteLast']; $industries = explode(",",$line['industry']); player_name($nameFirst,$nameLast,$pid); asort($industries); foreach ($industries as $industryList) { echo '<div class="list_school">' . $industryList; echo '</div>'; } //echo '<li>'. $line['industry'] .'</li>'; } echo '</div>'; //end of profile } add_shortcode('test', 'test'); style.css @charset "utf-8"; /* CSS Document */ .full-name a { color: #ccc; font-size: 100px; } Here is the output link: http://wolomarketing.com/players-home/
  5. Style.css is in the same directory as the file these functions are on. So both are in wp-content/plugins/brand-match/. Function test() queries and outputs User information out of a custom table. It'll be function athlete-bio() shortly. It functionally works, but I want to use 'best practice' way of incorporating CSS.
  6. Creating a WP plugin for third party usage (first time doing this), and typically links to stylesheets are put in the header or in the theme generated options panel. That's fine for personal use but not for this. I found wp_enqueue_style via a search on here, and I'm trying to apply it. Below is the code I have right now. function wpse_load_plugin_css() { $plugin_url = plugin_dir_url( __FILE__ ); wp_enqueue_style( 'style', $plugin_url . 'style.css' ); } add_action( 'wp_enqueue_scripts', 'wpse_load_plugin_css' ); function test() { global $con; wp_enqueue_style('style'); ** the bulk of my code - query and output ** } None of my styling is working at this point. I've cleared the cache, and this early stage, just trying to change the size of fonts. Am I on the right track? (probably not) Thank you.
  7. I'm trying to change all school served email addresses to NULL because they are mostly static and in the schools data table. Some coaches list their non-school email address, so I keep that with them as they change jobs. I'm mostly just trying to clean up the coach data table to make sure I don't have conflicting information. However, the below query is changing all the rows to NULL, including the ones with gmail and yahoo. update a_coach set server = NULL where server != "gmail.com" or server != "yahoo.com" I've also tried it with <> instead of !=. Same result. This seems like it should've been pretty straight forward.
  8. Making those group_concat worked. I understood that I have multiple types in that column, but it was all working accept the decommit part. Still don't understand why decommit part didn't work, even after I removed the commit CASE, but it works now. Thank you.
  9. When I removed the CASE/commit, the decommit still doesn't show up, and those two cases aren't group_concat.
  10. So we're clear on the GROUP_CONCAT, I have the following code dealing with that row: This one deals with the time components. I have a similar one dealing with the colleges. CASE as commit is working and has been since May of 2020. CASE as decommit, which I added last night, is not working. if (isset($line['offers'])) { echo '<div class="college-list">'; // This is for a player who has a List if (isset($line['list'])) { echo '<table><th>Final List</th>'; $listSchools = $line['list']; $listDate = $line['timeList']; // Turn CSV into unordered list $listSchools = explode(",",$listSchools); $listDate = explode(",",$listDate); array_multisort($listSchools,$listDate); foreach (array_combine($listSchools, $listDate) as $list => $ldate) {
  11. How does it separate the 'commit' and work as expected but not the 'decommit'? This is what the output looks like: https://www.courtsideindiana.com/tag/kamari-lands/ The 'commit' triggers the top line of the profile, as well as the asterisks next to the college of choice. He recently de-committed from Syracuse. There are no 'list' instances for this player. Until I added the CASE for 'decommit', this code has been unchanged, working and live on my site since May of 2020.
  12. I left column 'other' out of the database picture. It's for those who commit to a college in a sport other than basketball or commit as a walk-on (no scholarship).
  13. The below query has worked up to now fully as intended until yesterday when I added one additional CASE. It's the final one, dealing with 'recommit'. I've stripped out all the other output. This code ultimately looks what scholarship offers are being made from colleges, if the player made a final list, then finally a commitment. However, we've had a couple of players break free from their commitment, and we want to note that. Code wise, I'm looking to have the 'decommit' trump the 'commit'. However, that's not the issue I'm having up to this point. Right now, it's not recognizing the Decommit in the database. So my output at the bottom: echo $line['decommit']; ...doesn't show anything. Here is the query and output. $query = "SELECT *,p.id as pid, concat(nameFirst,' ',nameLast) as nameFull, GROUP_CONCAT( CASE WHEN recruit_type = 'Offer' THEN c.college END) as offers, GROUP_CONCAT( CASE WHEN recruit_type = 'List' THEN c.college END) as list, GROUP_CONCAT( CASE WHEN recruit_type = 'Offer' THEN date_format(po.time, '%m.%d.%y') END) as time, GROUP_CONCAT( CASE WHEN recruit_type = 'List' THEN date_format(po.time, '%m.%d.%y') END) as timeList, CASE WHEN other !='' THEN concat(c.college,' (',other,')') WHEN recruit_type = 'Commit' THEN c.college END as commit, CASE WHEN recruit_type = 'Decommit' THEN c.college END as decommit FROM a_players p LEFT JOIN a_schools s ON p.schoolID = s.id LEFT JOIN a_players_offers po ON p.id = po.playerID LEFT JOIN a_colleges c ON po.collegeID = c.id WHERE CONCAT(lower(nameFirst),'-',lower(nameLast)) = '".$tag."' || CONCAT(nameFirst,' ',nameLast) = '". $search ."' ORDER BY list,offers "; // End tag vs search term, finish the query $results = mysqli_query($con,$query); echo mysqli_error($con); while($line = mysqli_fetch_assoc($results)) { echo $line['decommit']; } This is what the last few rows in the database look like: I've checked spelling. I've made sure there isn't whitespace. I didn't think adding the extra case with an alias would be the problem I'd have, but I'm having it.
×
×
  • 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.