Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. I think I figured it out. It may have been a max-size issue with another image.
  2. Hello, I have my left and right margins set at auto for the img tag in the .home-middle-3 class. The image that doesn't appear to be centered is the Boys Club image. http://grassrootsindiana.com/
  3. It doesn't show an error. Here is the page: http://metroindybasketball.com/fall-league-2011/
  4. I mean come on. It's going to be some comma or misplaced period. I"m getting the following error: Line 28 is the WHILE statement. : ( $query = 'SELECT * FROM fallLeague10 WHERE confirm = "y" ORDER BY team,feet DESC,inches DESC,nameLast'; $results = mysql_query($sql) or trigger_error('MySQL error: ' . mysql_error()); $currentTeam = false; while($line = mysql_fetch_assoc($results)) { if($currentTeam != $line['team']) { //Status has changed, display status header $currentStatus = $line['team']; echo '<tr><td colspan="6"><hr></td></tr>'; } echo '<tr> <td></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>';
  5. As usual, it's something stupidly simple, like a typo. hschool instead of school. Thanks for your time guys. Sorry it wasn't even a code issue.
  6. I am understanding. I put the exact code Adam told me to put, and that was what it produced, which is what I posted in the response above.
  7. Even with Adam's code, it produces: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/jwrbloom/public_html/hoosierhoopsmagazine.com/resources/sectional_assignments.php on line 7
  8. I've been looking at ORDER BY examples, and what I've found so far tells me to do it that way. I'll keep looking.
  9. I'm getting an invalid argument error for my While loop. I can't figure out why. $sql="SELECT * FROM schools ORDER BY class DESC,sectional ASC,team ASC"; $results = mysql_query($sql); while ($team = mysql_fetch_assoc($results)) { echo $team['school'] . '<br>'; } Here is the error:
  10. It appears I had the wrong syntax. Thanks. That worked.
  11. I'm using Sequel Pro on Mac. My query is: SELECT * FROM fallLeague10 WHERE confirm!='y' I have three values: y m NULL I'm trying to get the rows that aren't y. Only the rows of m show up. I can't get the NULL rows to show up.
  12. Is there another way I should do it? I guess if you can find it, get to it, have the same name as the coach with the same user id...go for it.
  13. I did it to eliminate special characters from names, such as apostrophes and hyphens from names. They don't play nicely with WordPress' taxonomy.
  14. Maybe a similar issue dealing with empty fields. In the Update query, can I use a if(!empty) as part of the query for each field? I want the User/coaches to be able to update their mistake, and the Update query allows the coach to do that if they match the player's first name and last. It was originally set up to make sure the same player isn't entered multiple times, but it also gives the coach a chance to update any information.
  15. Ok...this goes into the "duh" column. I can just use !empty. : ) Sometimes posting about it here helps me think through it. if (!empty($comments['msg'])) { echo '<span class="roster_player_name">' . $comments['playerFirst'] . ' ' . $comments['playerLast'] . ': </span>'; echo $comments['msg'] . '<br><br>'; }
  16. The only field I need left NULL is the comments (form)/msg (query) field. If it's empty, the query just needs to bypass it because submitting it as blank just leaves the field in my data table blank.
  17. I realize I might not have been clear. I want the form to recognize that field is blank, and if it is do nothing. I also want to make sure "do nothing" leaves that field as (NULL)
  18. @nighslyr, the problem with that is it's part of a bigger form and not a required field. In fact, I would say more times than not, it would be left blank. It's coaches entering roster information, and they would likely put in some comments about top players or players needing to take on a bigger role. In the comment section of the output, I only want to echo the names that have comments...and the comments. It's the $msg variable below. I should have posted the code initially. My apologies. The rest of this code works extremely well as intended, and I use its structure on two sites. $playerFirst = $_POST['playerFirst']; $playerLast = $_POST['playerLast']; $tid = $_POST['tid']; $school = $_POST['school']; $feet = $_POST['feet']; $inches = $_POST['inches']; $year = $_POST['year']; $position = $_POST['position']; $msg = $_POST['content']; $ppg = $_POST['ppg']; $rpg = $_POST['rpg']; $apg = $_POST['apg']; $spg = $_POST['spg']; $bpg = $_POST['bpg']; $fgp = $_POST['fgp']; $ftp = $_POST['ftp']; $status = $_POST['status']; /* search for existing row */ $sql = "SELECT msg_id FROM players as p INNER JOIN schools as s WHERE p.playerFirst='".mysql_real_escape_string($playerFirst)."' AND p.playerLast='".mysql_real_escape_string($playerLast)."' AND p.tid=$tid"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); /* update existing row */ $sql = "UPDATE players SET pschool='" . $school . "', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."', year='".mysql_real_escape_string($year)."', position='".mysql_real_escape_string($position)."', msg='".mysql_real_escape_string($msg)."', ppg='".$ppg."', rpg='".$rpg."', apg='".$apg."', spg='".$spg."', bpg='".$bpg."', fgp='".$fgp."', ftp='".$ftp."', status='".$status."' WHERE msg_id='".$row['msg_id']."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } else { /* insert new row */ $sql = "INSERT INTO players SET playerFirst='".mysql_real_escape_string($playerFirst)."', playerLast='".mysql_real_escape_string($playerLast)."', tid='". $tid ."', pschool='" . $school . "', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."', year='".mysql_real_escape_string($year)."', position='".mysql_real_escape_string($position)."', msg='".mysql_real_escape_string($msg)."', ppg='".$ppg."', rpg='".$rpg."', apg='".$apg."', spg='".$spg."', bpg='".$bpg."', fgp='".$fgp."', ftp='".$ftp."', status='".$status."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } }
  19. I have one field which is set up as a Text field in my database. What I'm wanting is if the field is blank in the form to just leave the field alone in the database. I need it to be NULL. OR...is there a way to query a database to recognize a field is blank?
  20. Here's the code that finally worked: $sql = "SELECT * FROM players as p INNER JOIN schools as s WHERE s.coachFirst='".$current_first."' AND s.coachLast='".$current_last."' AND s.id = p.tid ORDER BY status, playerLast"; $results = mysql_query($sql); echo '<div class="roster">'; $team = mysql_fetch_assoc($results); echo '<div class="roster_team_info">' . $current_first . ' ' . $current_last . ' <div class="school">' . $team['school'] . '</div> <div class="coach">Coach ' .$team['coachFirst'] . ' ' . $team['coachLast'] .'</div> <div>Sectional: ' . $team['sectional'] . '</div> <div>Class: ' . $team['class'] . 'A</div> '; echo '</div>'; echo '<div class="roster_player_list">'; mysql_data_seek($results,0); $currentStatus = false; //Flag to detect change in status while($player = mysql_fetch_assoc($results)) { if($currentStatus != $player['status']) { //Status has changed, display status header $currentStatus = $player['status']; echo '<br><b>'; if ($currentStatus == '1') {echo 'Returning Starters';} elseif ($currentStatus == '2') {echo 'Key Returners';} elseif ($currentStatus == '3') {echo 'Varsity Newcomers';} elseif ($currentStatus == '4') {echo 'Key Freshmen';} echo '</b><br>'; // echo "<div><b>{$currentStatus}</b></div>\n"; } //Display player info echo $player['playerFirst'] . ' ' . $player['playerLast'] . ', ' . $player['feet'] . '\'' . $player['inches'] . '",' . $player['position'] . ', ' . $player['year'] . ';<br>'; } I added the mysql_data_seek in there. It works nicely now. Is that the most efficient way to handle multiple queries on a file? I have other projects that have multiple queries, to the point where they are pretty daunting to change as I adapt them to my needs. Should I make the conversion to this? I'm even talking about the help I got on another topic dealing with While / IF nested loop too.
  21. This is the entire code now: $sql = "SELECT * FROM players as p INNER JOIN schools as s WHERE s.coachFirst='".$current_first."' AND s.coachLast='".$current_last."' AND s.id = p.tid ORDER BY status, playerLast"; $results = mysql_query($sql); echo '<div class="roster">'; $team = mysql_fetch_assoc($results); echo '<div class="roster_team_info">' . $current_first . ' ' . $current_last . ' <div class="school">' . $team['school'] . '</div> <div class="coach">Coach ' .$team['coachFirst'] . ' ' . $team['coachLast'] .'</div> <div>Sectional: ' . $team['sectional'] . '</div> <div>Class: ' . $team['class'] . 'A</div> '; echo '</div>'; echo '<div class="roster_player_list">'; $currentStatus = false; //Flag to detect change in status while($player = mysql_fetch_assoc($results)) { if($currentStatus != $player['status']) { //Status has changed, display status header $currentStatus = $player['status']; echo '<br><b>'; if ($currentStatus == '1') {echo 'Returning Starters';} elseif ($currentStatus == '2') {echo 'Key Returners';} elseif ($currentStatus == '3') {echo 'Varsity Newcomers';} elseif ($currentStatus == '4') {echo 'Key Freshmen';} echo '</b><br>'; // echo "<div><b>{$currentStatus}</b></div>\n"; } //Display player info echo $player['playerFirst'] . ' ' . $player['playerLast'] . ', ' . $player['feet'] . '\'' . $player['inches'] . '",' . $player['position'] . ', ' . $player['year'] . ';<br>'; }
  22. Not sure mysql_result is working. I put... $team = mysql_result($results, 0); I'm not even sure how the result I got came up. It should only get one result, so the 0 is the offset value, which means it starts at the first row. I think I understand that correctly. JWR Bloom 2 Coach 2 2 Sectional: 2 Class: 2A
×
×
  • 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.