Jump to content

Jim R

Members
  • Posts

    1,006
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. @ManiacDan, I was looking for general advice from someone who might've experienced this in the past. I could've said the tabs had nothing to do with it because it was doing it before I added the tab short code.
  2. I found the solution. I had some meta data on the files for the INCLUDE. Deleted all the normal HTML stuff that heads off a html file, and it solved my spacing issue.
  3. http://metroindybasketball.com/fall-league-2012/ Check out the tabbed content. Under Standings and Schedule, both are information from INCLUDEd php files. Using Firebug, it reveals there is a <p> and three <br />'s that I didn't add. They only show up when I put in the INCLUDE. How do I go about getting rid of that? I don't see that it's part of the page code.
  4. I did that, and I still wasn't getting it figured out. Why wouldn't someone such as myself not start by taking something that provided the correct result and try to apply to the next, similar problem? The reality was, not only did it work in the previous instance on the same page, it was derived here with Psycho's help. Once I changed the quotes and removed the var_dump, it worked, at least in terms of structure. Now I'm trying to figure out how get the $collegeSubs array to print out instead of the abbreviations. (That's not reflected in the code presented thus far.) Another pesky foreach loop I suppose, but I keep getting invalid arguments.
  5. Ooops...looks like the var_dump broke the loop.
  6. Ok...single quotes instead of double quotes. Now it just prints the last instance.
  7. That doesn't really help me. I've already long since searched and read that.
  8. Commenting out the {if ($reason) loop. It's not carrying forward the values, despite showing up in the var_dumps. echo '<div class="reason"><p>'; var_dump($reasonData); foreach($reasonData as $reason => $reasData) echo '<p>' . var_dump($reason) . ' ' . var_dump($reasData) . '</p>'; //{if ($reason !=0) { // var_dump($reasData); echo 'College {$reason}<br>\n'; foreach($reasData as $subscription_type => $member_count) { echo '{$subscription_type}: {$member_count} members<br>\n'; } } //} echo '</p></div>';
  9. Below is the screen with var_dump($reason) and var_dump($reasData).
  10. You asked why I started with the {. I told you why. You told me I didn't know what I was doing. I agree. I did post the entire contents of the screen and noted in my reply there was no change in eliminating the brackets. You were posting as I was editing. What I saw in the PHP Manual shows braces after the foreach line, so I would assume based on PHP Manual, the syntax the another mod HERE helped me come up with is accurate. So, I'm back to my initial problem. I took what worked in the section above and tried to use it to get a similar output with different variables. It doesn't work, which is why I'm here. Can you help me do that? :-)
  11. It tells me it doesn't work, and when that syntax worked above, I went with it. I have not problem stipulating I don't know code very well. That's why I'm here. I didn't come here asking for anyone to write it. I'm trying to get at why it's wrong or not working. I removed the brace as you suggested. It gave me an error. :-) I removed the ending brace, and it didn't change my result beyond not having the error anymore. Perhaps it was originally a mistake, as I also took it off the section above, which had no change to my results, but that code was provided by one of the mods here. And for what it's worth, the PHP Manual shows the syntax as: foreach ($arr as &$value) { $value = $value * 2; }
  12. I took the bracket away and got an error. It's the exact same syntax as the section above, which worked, not only in terms of results but also relative to syntax.
  13. Because that's how the part above was coded just after the 'foreach'. It worked in determining Regions, so I tried to copy it for the Reasons(colleges). :-)
  14. When I put right after the foreach, I get the following: So I am getting something. foreach($reasonData as $reason => $reasData) echo '<p>' . var_dump($reason) . '</p>'; {if ($reason !=0) { echo 'College {$reason}<br>\n'; foreach($reasData as $subscription_type => $member_count) { echo '{$subscription_type}: {$member_count} members<br>\n'; } } } echo '</p></div>';
  15. var_dump($reason) produces nothing, which I presumed would be the case. The top section worked, and I tried to 'port it' to the second section, changing the variables as I felt were appropriate, but it didn't work. I can't always/usually get my head wrapped around foreach loops.
  16. Keep in mind, I've tried the variables with alias and without. No effect since none of the columns are redundant.
  17. The top portion came with help from here. I added the var_dump above it to show that the var_dump I'm getting on the second part appears to be working at least to that point. I have taken the first part and tried to duplicate it for the second part. The problem with the second part comes in that it doesn't print out. Here is the output: Here is the code: <link href="/styles/regions.css" rel="stylesheet" type="text/css" /> <?php mysql_select_db("jwrbloom_hhr"); $subscriptionLevels = array( 's2member_level2' => 'Yearly', 's2member_level1' => 'Semi-annual' ); // These are the Reasons. Users decide if they are high school fans or fans of colleges. If they are hsbball fans, they go in part one and are divided up by Region and subscription level. (That is working fine) If they are fans of the others, they go into part two and divided up by subscription level. $collegeSubs = array( 'hsbball' => 'High School', // actually, if they are hsbball, they are in the first part the rest are divided up for the second part 'bsu' => 'Ball State', 'bu' => 'Butler', 'cross' => 'Crossroad Conference', 'ue' => 'Evansville', 'glvc' => 'Great Lakes Valley', 'iu' => 'Indiana', 'ipfw' => 'IPFW', 'iupui' => 'IUPUI', 'isu' => 'Indiana State', 'nd' => 'Notre Dame', 'pu' => 'Purdue', 'valpo' => 'Valparaiso' ); $query = 'SELECT um.meta_value as level, um.meta_key, u.* FROM wp_usermeta AS um JOIN wp_users AS u ON um.user_id = u.ID WHERE u.region IS NOT NULL AND u.reason IS NOT NULL AND um.meta_value LIKE "%s2member%" GROUP BY u.ID asc ORDER BY reason,region,user_login'; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $user_region = $row['region']; $user_reason = $row['reason']; // Keep this - This determines the subscription of level of the user $level = unserialize($row['level']); $level_desc = key($level); //E.g. s2member_level3 if ($level_desc != "s2member_level4") { $user_level = $subscriptionLevels[$level_desc]; } // This ends the subscription level of the user // Here we start to figure out how many subscribe to each level for the first part if($user_reason == 'hsbball') { if(!isset($regionData[$user_region])) { $regionData[$user_region] = array_fill_keys($subscriptionLevels, 0); } $regionData[$user_region][$user_level]++; //end if } // Here is where we start to figure out how many subscribe to each level in the second part elseif($user_reason !='hsbball') { if(!isset($reasonData[$user_reason])) { $reasonData[$user_reason] = array_fill_keys($subscriptionLevels, 0); } $reasonData[$user_reason][$user_level]++; //end else } } //Output the HS Region results (first part) This is the part that works. echo '<div class="region">'; var_dump($regionData); foreach ($regionData as $region => $data) {if ($region != 0) { echo "<br>Region {$region}<br>\n"; foreach($data as $subscription_type => $member_count) { //var_dump($subscription_type); echo "{$subscription_type}: {$member_count} members<br>\n"; } } } echo '</div>'; //Output the College results (second part) None of this shows up beyond the var_dump. REGIONS aren't used here. echo '<div class="reason"><p>'; var_dump($reasonData); // This shows the data similarly to the first part above foreach($reasonData as $reason => $reasData) {if ($reason !=0) { echo 'College {$reason}<br>\n'; foreach($reasData as $subscription_type => $member_count) { echo '{$subscription_type}: {$member_count} members<br>\n'; } } } echo '</p></div>'; ?>
  18. Like I said, when I changed $confirm = wordwrap($message, 70); to $confirm = wordwrap($confirm, 70); It worked. I changed the language of the email's body, but here is the code for the second email being sent: // Confirmation email to the player $confirm = 'Hello, This is to confirm that ' . $_POST['nameFirst'] . ' ' . $_POST['nameLast'] .' has entered the Metro Indy Basketball Fall League. Thank you for entering. If you have not paid yet, you can do so at http://metroindybasketball.com/payment. Information on which team your son will be on and any updates will be posted at http://metroindybasketball.com, or you can also follow us at Twitter: @MetroIndyBBall or follow the search term #MIBFL. If you would like to see a list of those who are committed to play, you can check that out at http://metroindybasketball.com/committed. The #MIBFL starts Sunday, September 30, and runs through Sunday, October 28. We will post rosters the week leading up to the first day, likely on that Wednesday. Once the league starts, the website is also where you will find results. We are looking forward to the start of our sixth season! Thank you again for registering, Name Here'; // In case any of our lines are larger than 70 characters, we should use wordwrap() $confirm = wordwrap($confirm, 70); $confirmHeaders = "From: Metro Indy Basketball <[email protected]>"; // Send mail($_POST['email'], '2012 Fall League Registration', $confirm, $confirmHeaders);
  19. Figured it out. The issue I had was the line you copied last. The $message,70 needed to be $confirm,70. Thanks.
  20. That wraps the email message after 70 characters in the event of a longer message. The $confirm is what I altered from $message for the second email.
  21. The User's email address they use in the form.
  22. I have an HTML form set up, processed by PHP to enter information into a database and send me a confirmation email. It's worked great for two years, but I'm getting to the numbers where I'd like to have a separate confirmation email sent to the User after they register. Most of what I search for online, here and at PHP Manual sets up sending the same message to multiple people. Here is what I have being sent to me: // Email to me $message = $_POST['nameFirst'] . " " . $_POST['nameLast'] ." has entered the fall league.\n"; $message .= $_POST['feet'] . "'" . $_POST['inches'] ."\", " . $_POST['grade'] . "; " . $_POST['school'] ."\n"; $message .= $_POST['nameParent']."\n"; $message .= $_POST['email']; // 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('[email protected]', '2012 Fall League Registration', $message, $headers); Below is what I'm trying to send to my Users. I thought changing the variables would create the separate emails, but all I'm getting is the above email twice. // Confirmation email to the player $confirm = "This is to confirm that" . $_POST['nameFirst'] . " " . $_POST['nameLast'] ." has entered the Metro Indy Basketball Fall League.\n\n"; $confirm .= "Thank you for entering. Information on which team your son will be on and any updates will be posted at http://metroindybasketball.com around Wednesday, the week leading up to the start of the league. It starts Sunday, September 30. You may also follow us on Twitter: MetroIndyBBall and search for #MIBFL.\n\n"; $confirm .= "We are looking forward to the start of our sixth season!\n\n"; $confirm .= "Take care,\n\n"; $confirm .= "My Name Goes Here"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $confirm = wordwrap($message, 70); $confirmHeaders = "From: Metro Indy Basketball <[email protected]>"; // Send mail($_POST['email'], '2012 Fall League Registration', $confirm, $confirmHeaders);
  23. Yeah, thanks. It's little crap like that frustrate me. It still didn't unserialize the data, as it did for $custom, which you helped me with. The code PFMaBiSmAd provided, where would I put that? Just not sure where it fits: SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING(wp_s2member_custom_fields,LOCATE('s:6:"reason";s:',wp_s2member_custom_fields)),'"',4),'"',-1);
  24. Before revisited the topic, I tried another shot at it: (no avail) I took what Psycho had helped me with earlier in the year and tried to expand it by adding: // ***** Trying to determine why someone is subscribing $reason = unserialize($row['c_reason']); $user_reason = $reason['reason']; if ($user_reason = "iu") { echo $row['user_login'] . ' '; } // ****** end Reason testing area It just prints all the user names. I figured if it didn't work, it wouldn't print any of them. The entire code is below: $subscriptionLevels = array( 's2member_level3' => 'Yearly', 's2member_level2' => 'Semi-annual', 's2member_level1' => 'Monthly' ); $query = 'SELECT um1.meta_value as custom, um2.meta_value as level, um3.meta_value as c_reason, u.ID, u.user_login, u.user_email FROM wp_usermeta um1 INNER JOIN wp_usermeta um2 INNER JOIN wp_usermeta um3 ON um1.user_id = um2.user_id JOIN wp_users u ON um1.user_id = u.ID WHERE um1.meta_key = "wp_s2member_custom_fields" AND um2.meta_value LIKE "%s2member_level%" GROUP BY um1.user_id'; $result = mysql_query($query); //Process results into temp array $regionData = array(); while($row = mysql_fetch_assoc($result)) { //var_dump($row); $custom = unserialize($row['custom']); $user_region = $custom['county']; $level = unserialize($row['level']); $level_desc = key($level); //E.g. s2member_level3 // ***** Trying to determine why someone is subscribing $reason = unserialize($row['c_reason']); $user_reason = $reason['reason']; if ($user_reason = "iu") { echo $row['user_login'] . ' '; } // ****** end Reason testing area if ($level_desc != "s2member_level4") { $user_level = $subscriptionLevels[$level_desc]; } if(!isset($regionData[$user_region])) { $regionData[$user_region] = array_fill_keys($subscriptionLevels, 0); } $regionData[$user_region][$user_level]++; } //Output the results foreach ($regionData as $region => $data) {if ($region != 0) { echo "<br>Region {$region}<br>\n"; foreach($data as $subscription_type => $member_count) { //var_dump($subscription_type); echo "{$subscription_type}: {$member_count} members<br>\n"; } } }
  25. Where would that go in the current code?
×
×
  • 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.