Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. 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.
  2. 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>';
  3. 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.
  4. 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.
  5. 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?
  6. ...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.
  7. 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);
  8. Try this plugin: http://wordpress.org/extend/plugins/google-calendar-events/ It should give you the flexibility you need. I don't use the grid version, but I have modified the list version to suit my needs. It does use shortcodes, so check out the linked page or the plugin's developer home page.
  9. This is code being used to direct PayPal to create a subscription. It's going on a PHP page used in WordPress. The first section of code is what shows up on my end locally. The bottom set is what shows up when I view the source code in the browser. It's turning the element of each comment that closes the comment into –, and it adds line breaks. It's a theme issue, not a WordPress issue, as I've used this code on previous themes and another site. It still works in each instance. The theme producer is working with me on this, but his initial effort was replacing the style.css file. This is what I'm pasting: <!-- Customizes Prices, Payments & Billing Cycle --> <!--<input type="hidden" name="amount" value="8.00" />--> <input type="hidden" name="src" value="1" /> <input type="hidden" name="srt" value="" /> <input type="hidden" name="sra" value="1" /> <!--<input type="hidden" name="a1" value="0" />--> <!--<input type="hidden" name="p1" value="0" />--> <!--<input type="hidden" name="t1" value="D" />--> <input type="hidden" name="a3" value="8.00" /> <input type="hidden" name="p3" value="1" /> <input type="hidden" name="t3" value="M" /> </form> This is what shows up: <!--<input type="hidden" name="amount" value="8.00" />–><br /> <input type="hidden" name="src" value="1" /><br /> <input type="hidden" name="srt" value="" /><br /> <input type="hidden" name="sra" value="1" /><br /> <!--<input type="hidden" name="a1" value="0" />–><br /> <!--<input type="hidden" name="p1" value="0" />–><br /> <!--<input type="hidden" name="t1" value="D" />–><br /> <input type="hidden" name="a3" value="8.00" /><br /> <input type="hidden" name="p3" value="1" /><br /> <input type="hidden" name="t3" value="M" /><br /> (There was an initial issue of the extra line breaks causing white space problems. His style.css solved that. I've only been using this theme for a couple of weeks. I put the original style.css back in to see if the PayPal buttons worked. They didn't.)
  10. The redirect isn't working from within the loop.
  11. I moved the redirect (back to the entry page) into the 'else' part of the loop, so that eliminates the warning when the entry already exists. I'd like it to redirect (back to the entry page) even if the user inputs a name already in my database.
  12. I have a form set up to enter names into a database. If the name already exists, it should produce a message telling us that. When I submit that doesn't exist, it works just fine. When I test it with a name that meets the criteria I have set up, it produces "This player is already in the database," as it should, but I get the following warning. Warning: Cannot modify header information - headers already sent by (output started at /home/jwrbloom/public_html/resources/playerEntry/dbEnter.php:31) in/home/jwrbloom/public_html/resources/playerEntry/dbEnter.php on line 76 (76 is the last line of code) It does follow through and email me too. (I haven't tried to alter that yet.) $nameFirst = $_POST['nameFirst']; $nameLast = $_POST['nameLast']; $cityHome = $_POST['cityHome']; $school = $_POST['school']; $year = $_POST['year']; $position = $_POST['position']; $feet = $_POST['feet']; $inches = $_POST['inches']; $level = $_POST['level']; /* search for existing row */ $sql = "SELECT id FROM a_playerRank WHERE nameFirst='".mysql_real_escape_string($nameFirst)."' AND nameLast='".mysql_real_escape_string($nameLast)."' AND school='".mysql_real_escape_string($school)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); /* This tells us we already have him. */ {echo 'This player is already in the database.'; } } else { /* insert new row */ $sql = "INSERT INTO a_playerRank SET grouping='4', nameFirst='".mysql_real_escape_string($nameFirst)."', nameLast='".mysql_real_escape_string($nameLast)."', city='".mysql_real_escape_string($cityHome)."', school='".mysql_real_escape_string($school)."', year='".mysql_real_escape_string($year)."', position='".mysql_real_escape_string($position)."', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."', level='".mysql_real_escape_string($level)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } // Email to me $message = $_POST['nameFirst'] . " " . $_POST['nameLast'] ." was added to the database.\n"; $message .= $_POST['feet'] . "'" . $_POST['inches'] ."\", " . $_POST['year'] . "; " . $_POST['school'] ."\n"; $message .= $_POST['position']."\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: HHR Database Entry <noreply@hoosierhoopsreport.com>"; // Send mail('basketball@hoosierhoopsreport.com', 'Player database addition', $message, $headers); /* redirect user */ header("Location:http://hoosierhoopsreport.com/dbpe");
  13. I searched, and there isn't much and nothing really current. Is there a code that I could use to hide specific content based on what device my User is using? Specifically, if the the User is using a mobile phone browser. Something along the lines of: if ( !is_mobile( ) ) { } I've tried this, but it didn't work.
  14. Using WordPress, I wonder if that messes with how it processes the PHP within Posts and Pages. WordPress doesn't inherently let Users use PHP within Posts and Pages. There are a few good plugins that allow that, some using short code syntax, others just letting the User us normal PHP tags. Most (any that I would use) let the Admin determine who can use PHP in Posts, and in this case, just me.
  15. @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.
  16. 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.
  17. 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.
  18. 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.
  19. Ooops...looks like the var_dump broke the loop.
  20. Ok...single quotes instead of double quotes. Now it just prints the last instance.
  21. That doesn't really help me. I've already long since searched and read that.
  22. 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>';
  23. Below is the screen with var_dump($reason) and var_dump($reasData).
  24. 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? :-)
×
×
  • 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.