Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. Could I utilize Case in the Order By part of my query? Order By "commit" where "college" (the college committed to) != "colleges" (the college recruiting him)
  2. Is there a way to take my results assigning value to a variable so I can change where it shows up on my list without altering the database? I can make it not echo the instance I noted above, but I can't change where it shows up. The page title controls one of the query variables, in this case Purdue University. Any player in the database recruited by Purdue will eventually show up on that list. However, most of them will commit to play for another school. I want to be able to reflect that a player has been recruited by one school yet committed to another.
  3. Indeed what?
  4. Really it would just be an IF. Here is a link to my page: http://hoosierhoopsreport.com/pu I want the instance of... Bryant McIntosh 6'4" Greensburg Committed to Indiana State ...in the Offered group. This will allow me to reflect where a player decided to attend who was offered a scholarship by the college in the current view. The trigger is the column "commit". When pr.college != pc.colleges (which matches the WordPress page title / $page), it basically says that player did not commit to the college in the current view. They committed somewhere else. Somehow when Bryant McIntosh' instance comes through the query, pr.commit needs to not equal "y" // Gets Page title $page = get_the_title(); //echo $page; $sql ="SELECT * FROM a_playerRank AS pr, playerCollege AS pc WHERE pr.id = pc.id_player AND pr.year = '2014' AND pc.colleges = '". $page ."' ORDER BY pr.commit desc,pc.offer desc,pr.nameLast "; $results = mysql_query($sql); $position = array ( '1' =>'PG', '2' =>'SG', '3' =>'SF', '4' =>'PF', '5' =>'C' ); $currentCommit = false; $currentOffer = false; echo '<div class="recruitWrap">'; while ($line = mysql_fetch_assoc($results)) { if ($currentCommit != $line['commit']) { $currentCommit = $line['commit']; if ($line['commit'] == 'y') { echo '<div class="recruitHeader">Committed</div>'; } else { echo '<div class="recruitHeader">Offered</div>'; } } if ($currentOffer !=$line['offer']) { $currentOffer = $line['offer']; if ($line['offer'] == 'y') { } else { echo '<div class="recruitHeader">Also recruiting</div>'; } } //if((ISSET ($line['college']) && $line['college'] == $line['colleges']) || !ISSET($line['college'])) echo '<div class="recruitRow"> <div class="recruit">' . $line['nameFirst'] . ' ' . $line['nameLast'] . '</div>'; echo '<div class="recruit recruitHeight">' . $line['feet'] . '\'' . $line['inches'] . '"</div>'; echo '<div class="recruit recruitPosition">' . $position[$line['position']] . '</div>'; echo '<div class="recruit recruitSchool">'; if ($line['city'] !='') { echo $line['city'] . ' (' . $line['school'] . ')'; } else { echo $line['school'] . ' HS'; } echo '</div>'; // city school echo '<div class="clear"></div>'; echo '</div>'; if($line['college'] != $page) { echo '<div>Committed to '. $line['college'] .'</div>'; } } echo '<div class="clear"></div>'; echo '</div>'; // recruit wrap
  5. Yes, that makes perfect sense, and in having mismatched variables, it 'worked'. It was weird though, I went awhile with no spam after having some, then it returned a few days ago. I'll be curious to see how long I go now without spam, but there are a couple of patterns the spam is inputting that I could deal with as well should not the do the trick entirely.
  6. OK...I may have found out the problem. And yes, I'm a moron, and as I've posted on here several times this is why coding for a living would a) not be an option, and b) drive me insane: The problem: The field names were mismatched all along "email2" on the form, "Email2" on the enter.php. So when I changed both to "name" it 'stopped' working. It never worked. However, I found a similar solution, and it looks like I did it wrong the whole time: http://www.webdesignerforum.co.uk/topic/68584-anti-spam-form-without-captcha/ Basically, I needed to set up the hidden field with an empty value = '', so if it remained empty keep going, but if a spam bot fills it, stop and say "thanks for playing". Luckily my wild goose chases only happen about twice a year. One time we had this long a$$ discussion with two or three guys trying to help. Each one of us saying there is no reason this shouldn't work. It came down to having a comma instead of a period. Like anything, if you get enough eyes onto the subject, eventually you'll find the solution, even if it makes you look harder at your own code. I had kept the php files open since I made the changes, so I was able to CTRL-Z back to where they were before the change. That's when I noticed the difference in the capital E in Email2. Thank you for your time. I've tested the solution I linked, and it's working great...at least in terms of letting the form go through. We'll see how it does with spam over the next few days.
  7. I understand what you're saying, but keep it on simple terms here. I have a form with a hidden field called "name". The form sends the user to enter.php where it's processed. The first thing enter.php does is... <?php // Make sure this person is real if (ISSET ($_POST['name'])) { echo 'Thank you for playing'; } // If so move on else { $nameFirst = $_POST['nameFirst']; $nameLast = $_POST['nameLast']; $nameParent = $_POST['nameParent']; $email = $_POST['email']; $addressHome = $_POST['addressHome']; $cityHome = $_POST['cityHome']; $stateHome = $_POST['stateHome']; $zipHome = $_POST['zipHome']; $phoneHome = $_POST['phoneParent']; $phoneMobile = $_POST['phoneMobile']; $school = $_POST['school']; $grade = $_POST['grade']; $coachSchool = $_POST['coachSchool']; $feet = $_POST['feet']; $inches = $_POST['inches']; From there it goes on to check if the Registrant is in the database. If so, it updates it. If not, it inserts him. Then it sends out emails and redirects the Registrant to the payment page. Now, if I change "name" to "name1", the form now works because "name1" doesn't get set because there is no "name1" in the form. Registrant information gets sent to database, emails get sent.
  8. I appreciate that thinking, but I didn't change anything else. Even if I had, the ISSET is the first thing on the php file processing the form. It's not getting past the IF...ELSE. Also, mismatching the variable allows the form to work, so once it gets past the IF...ELSE, it works just fine.
  9. I tried that before even seeking help.
  10. The logic is that if the spam bot populates the hidden field, the form isn't really processed. I think I picked up the idea from here somewhere, but I didn't follow or comment on the topic, so I can't find it. I did search for it before I posted this topic. The form is taking information from registrants to participate in a basketball league. Upon successful registration, their name is entered into the database and an emails are sent to them and me. Their names are also put on a published list. I had it up from July 6 to August 13, two days ago, and it was working. Until August 8 or 9, it was keeping spam out, while allowing successful registrations through. That has changed this week. What I'm getting with the spam is gibberish information. I think I can detect a pattern to what it's doing, typically nameFirst = nameLast, but I haven't had any registrations the last two days because of the issue I posted about. It hasn't let any registrations through since I made my change. All I did on the 13th was change the input name of the hidden field from email2 to name, and somehow it's not working anymore. I made no other change to the form, and I made the same change to the php code processing the form. I was hoping changing the name of the field would confuse whatever spam bot had found it's way through. I'm not logging any headers. @darkfreaks, my reCaptcha is through Google
  11. Just to clarify, that method allowed 86 legitimate registrations to go through, and only in the last couple of days had spam started showing up.
  12. I have a form on my site, and captcha isn't really working very well at keeping spam out. I put a hidden field in my form, and that was doing the trick for awhile, but while not as much as before, I was still getting an occasional spam submission. I thought changing the $_POST label would help, but now it won't work. I made no other changes than to the form and the code processing the form. Form HTML: <input name="name" type="hidden" /> **** php file *** if (ISSET ($_POST['name'])) { echo 'Thank you for playing'; } else { //process form } It was "email2". Changing it to "name" has caused it to not work, and no other field is called "name".
  13. First of all, I have a lot of code and WordPress shortcodes determining which User can see which content. My issue is the query and how it's ordered. There are three primary groups: 1) (Top 10) Ordered numerically based on the ranking I give them, typically 1-10. 2) (Best of the Rest) Should be ordered alphabetically based on nameLast. 3) (Names to Know) Is divided into Regions of the state (I have headers for each region), then listed alphabetically. The issue is Group 2. It's being ordered the same as group 3, just without the headers. I tried flipping 'region' and 'nameLast', but that really screwed up group 3. I attached a screenshot of what it looks like. I was surprised I could get the 3rd group the way I wanted it, but now I can't wrap my head around the logic of how to alphabetize the 2nd group. $query = 'SELECT * FROM a_playerRank WHERE year="2014" and position="2" and grouping<4 ORDER BY grouping DESC,rankPos,region,nameLast'; $results = mysql_query($query) or trigger_error('MySQL error: ' . mysql_error()); $currentGrouping = false; $currentRegion = false; while($line = mysql_fetch_assoc($results)) { if($currentGrouping != $line['grouping']) { //Status has changed, display status header $currentGrouping = $line['grouping']; if($line['grouping']==2) { echo '<thead> <tr> <th class="num">#</th> <th class="top"></th> <th class="height">HT</th>'; if (current_user_can("access_s2member_level4")){ echo '<th class="level">Level</th>'; } echo' <th class="school">City (School)</th>'; if (current_user_can("access_s2member_level4")){ echo '<th class="summer">Summer Team</th>'; } echo' <th class="college">College</th> </tr> </thead>'; } elseif($line['grouping']==1) { echo '<tr><th colspan="7">Best of the Rest</th></tr>'; } elseif($line['grouping']==0) echo '<tr><th colspan="7">Names to Know</th></tr>'; } // Determine what region the player plays if($currentGrouping=="0") { if($currentRegion != $line['region']) { $currentRegion = $line['region']; echo '<tr><th colspan="7" class="region">Region '. $line['region'] . ' :: '; if($line['region']==1) echo 'The Region'; if($line['region']==2) echo 'South Bend, Elkhart'; if($line['region']==3) echo 'Fort Wayne, Marion'; if($line['region']==4) echo 'Lafayette, Kokomo, Greencastle'; if($line['region']==5) echo 'Indianapolis metro area'; if($line['region']==6) echo 'East Central Indiana - Muncie, Richmond, as I-74 hits Ohio'; if($line['region']==7) echo 'Bloomington, Terre Haute, Bloomington'; if($line['region']== echo 'Columbus, Madison, Louisville area'; echo '</th></tr>';} } echo ' <tbody>'; if (empty($line['pro']) && ($current_user->ID == 1587)) { } else { //if (isset($line['pro'])) { echo '<tr> <td>'. $line['rankPos'] . $line['devPos'] . '</td> <td class="nowrap">'; if ($line['wpID'] > '0') { echo '<a href="/tag/' . $line['wpSlug'] . '">'. $line['nameFirst'] . ' ' . $line['nameLast'] . '</a>'; } else { echo $line['nameFirst'] . ' ' . $line['nameLast']; } echo '</td><td>'. $line['feet'] . '\'' . $line['inches'] . '"</td>'; if (current_user_can("access_s2member_level4")){ echo '<td>'. $line['level'] . '</td>'; } if ($line['city'] !='') { echo '<td class="nowrap">' . $line['city'] . ' (' . $line['school'] . ')</td>'; } else { echo '<td class="nowrap">'. $line['school'] . ' HS</td>'; } if (current_user_can("access_s2member_level4")){ echo '<td>'. $line['summer'] . '</td>'; } //else //{ echo '<td></td>'; //} echo '<td>'; if ($line['commit'] == 'y') { echo ' <strong>'. $line['college'] . '</strong> ';} echo '</td></tr>'; if (current_user_can("access_s2member_level4")){ if (!empty($line['pro'])) { echo '<td></td><td colspan=6><span class="analysis">'. $line['pro'] . ' :: ' . $line['con'] .'</span></td>'; } } } } echo '</tbody></table></div>';
  14. Trying to execute this query: UPDATE a_playerRank AS p, wp_terms as t SET p.wpID = t.term_id WHERE p.wpSlug = t.slug I get the following error: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=' As far as I can tell, applicable columns are utf8_unicode_ci and none are utf8_general_ci. I've searched for solutions here and on elsewhere. Can't make much of what is being suggested.
  15. Oooo...very nice!! That worked, and it even kind of makes sense to me. :-) Thank you to you three who answered!
  16. Got your DM. That code brought it back to where it was before I tried the foreach. It posts the Team Number but no coach's name, then the roster underneath. I left it there so you could see it.
  17. No, I don't have the coaches' names in the database. I figured I could make it work via an array.
  18. I'm really not able to wrap my head around what you said. I wasn't able to get the right results before trying the foreach loop so I resorted to the IF loop. That gave me the follow: A1 - player name player name player name etc A2 - player name player name etc That didn't put in the coaches' names. I'm trying to get help on the foreach loop relative to the array. The IF statement works without the array. I went with it instead of the foreach but would like get the desired result.
  19. I'm trying to create a list of Rosters all on one page from a data table. I want each roster to show its Team Number ($team) and coaches name ($nameCoach) at the top of the list. I tried moving the Foreach loop around, but I can't get the results I want. So it should look like: A1 - Coach Brett Crist player name player name player name etc A2 - Coach Paul Goser player name player name etc Here is the link to the page. Basically, for each player it lists all the coaches. http://metroindybasketball.com/resources/league2012/2012rosters.php $coach = array ( 'A1' =>'Coach Brett Crist', 'A2' =>'Coach Paul Gosser', 'A3' =>'Coach Brian Tonsani', 'B1' =>'Coach Dustin Harvey', 'B2' =>'Coach Kyle Smith', 'B3' =>'Coach Trevor Andershock', 'C1' =>'Coach Jim Reamer', 'C2' =>'Coach Aaron Butcher', 'C3' =>'Coach Bob Cerbone', 'D1' =>'Coach Larry Baker', 'D2' =>'Coach John Tate', 'D3' =>'Coach Victor Stallworth', 'E1' =>'Coach Mark Bailey', 'E2' =>'Coach Angelo Smith', 'E3' =>'Coach Mike Lawson', 'E4' =>'Coach Jeremy Tiers', 'F1' =>'Coach Aaron Butcher', 'F2' =>'Coach Duke Pryor', 'F3' =>'Coach Damon Hawkins', 'F4' =>'Coach Roy Hairston', 'G1' =>'Coach Kristof Kendrick', 'G2' =>'Coach Michael Tucker', 'G3' =>'Coach Kenton Granger', 'G4' =>'Coach Steve Turner', 'H1' =>'Coach Seve Beach', 'H2' =>'Coach Matt Lacey', 'H3' =>'Coach Derrick Gentry', 'H4' =>'Coach Kayle Funkhouser', 'I1' =>'Coach Courtney James', 'I2' =>'Coach Barry Kroot', 'I3' =>'Coach Chris Hawkins', 'J1' =>'Coach Chris Sibila', 'J2' =>'Coach Larry Baker', 'J3' =>'Coach Dan Schukraft' ); $query = 'SELECT * FROM fallLeague10 WHERE 2012team IS NOT NULL ORDER BY 2012team,2012number'; $results = mysql_query($query) //or trigger_error('MySQL error: ' . mysql_error()) ; $currentTeam = false; while($line = mysql_fetch_assoc($results)) { if($currentTeam != $coach) { foreach ($coach as $team=>$nameCoach) { //Status has changed, display status header $currentTeam = $line['2012team']; echo '<tr><td colspan="6"><hr></td></tr> <tr><td colspan="6"><span class="coach">'. $team . ' - ' .$nameCoach. '</td></tr> '; } } echo '<tr> <td>' . $line['2012number'].'</td> <td><b>' . $line['nameFirst'] . ' ' . $line['nameLast'] . '</b></td> <td><center>'. $line['feet'] . '\'' . $line['inches'] . '"</center></td> <td><center>'. $line['grade'] . '</center></td> <td>'. $line['school'] . '</td>'; echo '<td><b>'. $line['college'].'</b></td>'; echo '</tr>';} echo '</tbody></table>';
  20. I'm getting a result now, just not a desired one. Moving a player in the top 10 to the top of the list, makes him zero. Everyone else lines up 1-9. Moving a second player to the top causes everyone below him to adopt that number, so if I moved the 6th player there, from five to zero turn into a six.
  21. I'm sure it was confusing. My goal is to have front end (only to me) control of one of my data tables. I found this script that accomplishes that (letting me do it via touch on a tablet) with test data, and I'm trying to apply it to my needs. The link I provided shows it in action, but as I adjust the columns it saves to I'm not able to get the desired results. I didn't know what ABS referred to, and now that I do, it doesn't help me understand how this takes what shows on the screen and updates my data table.
  22. First question is, what does it do? I've searched, but all I can find are people trying to use or suggesting others use it and the various tangents that come with it. For example: What is this query saying? SELECT * FROM $table order by ABS(orderList) ASC The reason I'm asking is I came across some code that should let me/user rearrange items in a data table from the front end. Better, it works on an tablet via touch. Trying to adapt it to my specific needs is where I'm running into the problem. (works with a mouse/trackpad as well) http://hoosierhoopsreport.com/scripts/dragdrop/#sg Here is the original query code: $sql = mysql_query("SELECT * FROM $table order by ABS(orderList) ASC"); $num = mysql_num_rows($sql); while($row = mysql_fetch_assoc($sql)){ echo "<li class='ui-state-default' id='ID_".$row['list_id'] ."'>".$row['title']."</li>"; } } and here is the code the saves it back to the data table: $order = $_POST['ID']; $k = 1; $str = implode(",", $order); foreach ($order as $k => $val){ $query = "UPDATE $table SET `orderList` = ".$k; $query .= " WHERE `list_id` = ".$val; $res = mysql_query($query); if (!$res) echo mysql_error()."<br />"; } I'm trying to change this around to fit the columns of data that I have, and I'm having an issue since it's a little more involved than a simple list. I got it to echo my list, and the ability to manually change the order on the screen works. However, how is it recognizing the order on the screen, and how do I 'save' that back to my data table?
  23. ...not only edit the grid within the browser from a query view, AND be touch enabled for an iPad. There aren't really any good MySQL apps for the iPad. The best one I found still doesn't let one edit from a query. Browser editing can be done in phpMyAdmin, but that's not really what I'm looking for. I'd like to be able, while viewing the results of a query, rearrange rows while using my iPad. Not that I expect a sorted column to reflect the changes without me changing values, just that I want to do be able to sit at a basketball game with my iPad, change rows around visually via touch. From there I can changed the sorted values to reflect what I have visually. Example: If I wanted to move a player from one tier to another after my query, I'd just slide him into another tier. It would be great if my datatable could change his tier on the fly (Ex: moving from tier 1 to tier 3), but I'd expect to do that manually while still in query view. Has kind of a spreadsheet view, but that would puts me in a situation where I'd have import the changes. It also still wouldn't get me touch capabilities on my iPad. I was just reaching out to see if anyone knew of a script I could buy that did all of that.
  24. I'm trying to expand a form that currently just Inserts the User's information then emails me the results. They give me their name, email address, and favorite school, then they pick the winners of 64 sectional rounds. Currently I copy and paste all the emailed results into a spreadsheet and grade it against a master list. I'd like to input their answers into a datatable. I assume it will be a separate table than where the User information is input, linking it to their ID. Loop? Build an array? The latter I'm awful at, and whenever I search for it here and elsewhere, I never seem to quite find what I'm looking for. $nameFirst = $_POST['nameFirst']; $nameLast = $_POST['nameLast']; $email = $_POST['email']; $school = $_POST['school']; $sql="INSERT INTO hhr_sectionals SET year='2013', nameFirst='".$nameFirst."', nameLast='".$nameLast."', email='".$email."', school='".$school."'"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } // header( 'Location: /fall-league/payment' ); mysql_close($con) ?> <?php // The message $message = $_POST['nameFirst'] . " " . $_POST['nameLast'] . "\n"; $message .= $_POST['email'] . "\n"; $message .= $_POST['school'] . "\n\n"; $message .= $_POST['1'] . " :: Sectional #1\n"; $message .= $_POST['2'] . " :: Sectional #2\n"; $message .= $_POST['3'] . " :: Sectional #3\n"; $message .= $_POST['4'] . " :: Sectional #4\n"; $message .= $_POST['5'] . " :: Sectional #5\n"; $message .= $_POST['6'] . " :: Sectional #6\n"; $message .= $_POST['7'] . " :: Sectional #7\n"; $message .= $_POST['8'] . " :: Sectional #8\n"; $message .= $_POST['9'] . " :: Sectional #9\n"; $message .= $_POST['10'] . " :: Sectional #10\n"; $message .= $_POST['11'] . " :: Sectional #11\n"; $message .= $_POST['12'] . " :: Sectional #12\n"; $message .= $_POST['13'] . " :: Sectional #13\n"; $message .= $_POST['14'] . " :: Sectional #14\n"; $message .= $_POST['15'] . " :: Sectional #15\n"; $message .= $_POST['16'] . " :: Sectional #16\n\n"; $message .= $_POST['17'] . " :: Sectional #17\n"; $message .= $_POST['18'] . " :: Sectional #18\n"; $message .= $_POST['19'] . " :: Sectional #19\n"; $message .= $_POST['20'] . " :: Sectional #20\n"; $message .= $_POST['21'] . " :: Sectional #21\n"; $message .= $_POST['22'] . " :: Sectional #22\n"; $message .= $_POST['23'] . " :: Sectional #23\n"; $message .= $_POST['24'] . " :: Sectional #24\n"; $message .= $_POST['25'] . " :: Sectional #25\n"; $message .= $_POST['26'] . " :: Sectional #26\n"; $message .= $_POST['27'] . " :: Sectional #27\n"; $message .= $_POST['28'] . " :: Sectional #28\n"; $message .= $_POST['29'] . " :: Sectional #29\n"; $message .= $_POST['30'] . " :: Sectional #30\n"; $message .= $_POST['31'] . " :: Sectional #31\n"; $message .= $_POST['32'] . " :: Sectional #32\n\n"; $message .= $_POST['33'] . " :: Sectional #33\n"; $message .= $_POST['34'] . " :: Sectional #34\n"; $message .= $_POST['35'] . " :: Sectional #35\n"; $message .= $_POST['36'] . " :: Sectional #36\n"; $message .= $_POST['37'] . " :: Sectional #37\n"; $message .= $_POST['38'] . " :: Sectional #38\n"; $message .= $_POST['39'] . " :: Sectional #39\n"; $message .= $_POST['40'] . " :: Sectional #40\n"; $message .= $_POST['41'] . " :: Sectional #41\n"; $message .= $_POST['42'] . " :: Sectional #42\n"; $message .= $_POST['43'] . " :: Sectional #43\n"; $message .= $_POST['44'] . " :: Sectional #44\n"; $message .= $_POST['45'] . " :: Sectional #45\n"; $message .= $_POST['46'] . " :: Sectional #46\n"; $message .= $_POST['47'] . " :: Sectional #47\n"; $message .= $_POST['48'] . " :: Sectional #48\n\n"; $message .= $_POST['49'] . " :: Sectional #49\n"; $message .= $_POST['50'] . " :: Sectional #50\n"; $message .= $_POST['51'] . " :: Sectional #51\n"; $message .= $_POST['52'] . " :: Sectional #52\n"; $message .= $_POST['53'] . " :: Sectional #53\n"; $message .= $_POST['54'] . " :: Sectional #54\n"; $message .= $_POST['55'] . " :: Sectional #55\n"; $message .= $_POST['56'] . " :: Sectional #56\n"; $message .= $_POST['57'] . " :: Sectional #57\n"; $message .= $_POST['58'] . " :: Sectional #58\n"; $message .= $_POST['59'] . " :: Sectional #59\n"; $message .= $_POST['60'] . " :: Sectional #60\n"; $message .= $_POST['61'] . " :: Sectional #61\n"; $message .= $_POST['62'] . " :: Sectional #62\n"; $message .= $_POST['63'] . " :: Sectional #63\n"; $message .= $_POST['64'] . " :: Sectional #64\n\n"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); $headers = 'From: ' . $_POST['nameFirst'] . " " . $_POST['nameLast'] . "<" . $_POST['email'] . ">"; // Send mail('basketball@hoosierhoopsreport.com', 'Sectional Pick-em Contest 2013', $message, $headers);
×
×
  • 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.