Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. Problem is I don't ask for mobile numbers for every kid. Younger kids don't have it. Most families now don't really have or use home numbers, so I don't ask for it. Cities and schools would be too plentiful, especially since I get kids from three states.
  2. There is no great way for me eliminate duplicates upon entry. I can't just use first name and last name, because sometimes we have kids with the same name. I can't really use their school because sometimes the parents just use the school name, other times they put HS after it or High School, etc. So from year to year I get a lot of duplicate entries into my database. The problem arises for me when a kid is registered but doesn't pay right away, so mom or dad return to the site to pay, and instead of just paying they re-register. I'm trying to eliminate those. Of course when that is the case, they generate a new ID so I started there: select * from fallLeague10 as f1 join fallLeague10 as f2 where f1.nameFirst = f2.nameFirst and f1.nameLast = f2.nameLast and f1.confirm='1' and f1.id <> f2.id order by f1.nameLast, f1.nameFirst (confirm = they entered this year) I really can't make sense of why it's producing the list that it is. I'm not really getting duplicates, maybe a couple, but there are definitely non-duplicates in that list. Basically, what I'm looking to get is 8-12 names that show up twice (or three times in one instance). It's a 470 person lot, and I just want to make sure I don't miss any because my numbers have to be exact or some kid ends up on two teams. I figure a query would be better than scrolling through my list.
  3. Or how can I make this Update via a query: I have an email column joe@naccs.k12.in.us I'd like to have in the other email_acct column just naccs.k12.in.us
  4. My primary method of working with my database is Sequel Pro (Mac OS X), and I'm trying to update a column in a table via a CSV import. I should be able to do it via Sequel's Import, but I keep getting errors. I've made sure I'm Updating and not Inserting. I've mapped my column (just one column), and it's just a one column CSV file. I get this error for each row: I messed with what each is terminated by, escaped by, enclosed by...etc...nothing changes. I get the same error, just at the end it's a different email account location. So I'll try to do it via a query, but I can't find a reliable solution to make it work. I could create a separate table and update via that way, but I can use this as a learning experience.
  5. Never mind, I found my solution. I tried to edit my post, but too much time had past. Thank you.
  6. I'm searching for complex order by queries. Is this an issue where "case" would work?
  7. Here is the query: $query = 'SELECT * FROM a_playerRank WHERE year="2015" and position="1" and grouping<4 ORDER BY grouping DESC,rankPos,region,nameLast'; I have three groups (grouping). The first group is based on their ranking 1-10 or 1-15. (working fine) The second group is supposed to be alphabetical based on last name. (not working) The third group is supposed to be based on region, then alphabetically by their last name, and I have a header for each region. (working fine) I attached an image of grouping two and three. Group two (top group in the picture) isn't alphabetical. I know why the query isn't producing what I want, but I can't figure out the query I need to get my list to show as I described it. It shows the second group ordered by region then last name, just without headers. When I flip region and nameLast in the order by, the second group works great, but the third group basically produces a header for each kid (it looks like a mess). I assume there is a more complex query that will produce what I want.
  8. I figured it out. Once I figured out a value was printing the single_tag_title instead of passing a value to $slug, I dug more into the WP template tag. It acts a little differently than WP hooks I have used in other areas.
  9. var_dump($slug) is producing NULL In the code I quoted: $slug = single_tag_title(); It isn't assigning the value of single_tag_title to $slug. It's just printing it on the screen. single_tag_title is produced by WordPress taxonomy.
  10. You said use var_dump() so I did and wrote the results for you to read. var_dump($slug); produced => KJ WALTONNULL (css is producing the all caps) I did do "one thing and verified it works". I said in post #17 with simpler query, which I provided in the code box, the WHILE produced every name in the database for $nameFull in the format I defined. That means is produced on the screen KJ WALTON, which should've equaled what the $slug printed, KJ WALTON. The var_dump($slug) printed KJ WALTONNULL So I'll be more specific: I don't know why printing $slug would produce a different result than var_dump(). I would assume that if I knew why, I would be able to solve this for myself, but since I can't, I'm here asking questions.
  11. It's basically the Page slug with null at the end. KJ WALTONNULL Not sure how it would get that, but that's why I'm here asking questions. :-)
  12. I've tried it a different way: $slug = single_tag_title(); echo $slug; $query = "SELECT * FROM a_playerRank"; $results = mysql_query($query); echo mysql_error(); while($line = mysql_fetch_assoc($results)) { $nFirst = $line['nameFirst']; $nLast = $line['nameLast']; $nameFull = "{$nFirst} {$nLast}"; if ($nameFull == $slug) { No more error, but it's still not working. It prints the $slug properly. When I put in a line to echo $nameFull of the IF statement, it prints all of them properly, meaning first name (space) last name, so at some point is it printing a result for $nameFull that equals $slug. However, for the IF statement, it's not recognizing it.
  13. As best as I can tell, all my collations match. I also commented out the line that defines $slug, same error.
  14. ILLEGAL MIX OF COLLATIONS (UTF8_BIN,NONE) AND (UTF8_GENERAL_CI,COERCIBLE) FOR OPERATION '='
  15. Where should I echo the mysql_error()? Here is what it is showing: Line 13 is echo mysql_error($results);
  16. It's not the connection, selected database or table/column. The only time the error arrives is when I add the WHERE condition.
  17. Are we not trying to determine what is causing it? Bad syntax in the query or gathering of results.
  18. @objnoob, I got the same error using your second line. Maybe more information will help: In WordPress, I'm trying to match an Tag archive to the first and last name of the player in a separate data table, where I have profile type information. I had a small plugin I wrote that copied over their tag_id to the separate data table, but a WordPress upgrade broke it. As I was trying to fix it, I figured I could just use Tag Archive name and match it. So it used to work and work well.
  19. I'm trying match data from two different tables. The single_tag_title is producing the results I want via the echo, but I can't seem to get the syntax down in the query. $slug = single_tag_title(); echo $slug; $query = 'SELECT * FROM a_playerRank WHERE CONCAT(nameFirst," ",nameLast) = "$slug"'; $results = mysql_query($query); while($line = mysql_fetch_assoc($results)) { I get the following error:
  20. I tried to attach a CSV file earlier, but it wouldn't let me.
  21. It's printing 0 for the players with NULL in the "rankPos" column, even though in grouping 1 and 0 I don't have code for it to print rankPos.
  22. Can I have a Select *? I added the other columns I needed. It's printing 0 for the players with NULL in the "rankPos" column, even though in grouping 1 and 0 I don't have code for it to print rankPos.
  23. Do you mean from the database itself? I tried to attach a CSV file.
  24. Any help with this? I've looked up "conditional order by", but I'm not sure it applies to what I'm trying to do.
  25. I tried that first actually. It didn't work. I looked around and found something on Stackflow saying that wasn't used anymore. In testing the rowCount, I realized I had '$result' not '$results' but never went back to mysql_num_rows to test it again. Thanks.
×
×
  • 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.