egiblock Posted August 13, 2009 Share Posted August 13, 2009 $query_PlayerListName = "SELECT * FROM tbl_players WHERE tbl_players.playerID = $id"; $PlayerListName = mysql_query($query_PlayerListName, $golfscoring) or die(mysql_error()); $row_PlayerListName = mysql_fetch_assoc($PlayerListName); $totalRows_PlayerListName = mysql_num_rows($PlayerListName); $query_PlayerDetail = "SELECT tbl_players.playerID, tbl_courses.CourseName, tbl_events.eventName, (tbl_scores.s1 + tbl_scores.s2 + tbl_scores.s3 + tbl_scores.s4 + tbl_scores.s5 + tbl_scores.s6 + tbl_scores.s7 +tbl_scores.s9 + tbl_scores.s8 + tbl_scores.s12 + tbl_scores.s11 + tbl_scores.s10 + tbl_scores.s18 + tbl_scores.s17 +tbl_scores.s16 + tbl_scores.s15 + tbl_scores.s14 + tbl_scores.s13) AS totalScore, tbl_events.eventDateTime, tbl_players.PlayerName FROM tbl_scores Inner Join tbl_courses ON tbl_scores.courseID = tbl_courses.courseID Inner Join tbl_players ON tbl_players.playerID = tbl_scores.playerID Inner Join tbl_events ON tbl_scores.eventID = tbl_events.eventID WHERE tbl_scores.playerID = $id"; $PlayerDetail = mysql_query($query_PlayerDetail, $golfscoring) or die(mysql_error()); $row_PlayerDetail = mysql_fetch_assoc($PlayerDetail); $totalRows_PlayerDetail = mysql_num_rows($PlayerDetail); in my html document i have: <b> <?php echo $row_PlayerListName['PlayerName']; ?> </b> <br><br> then for the results i have the following table: <table width="100%" border="0" cellspacing="2" cellpadding="0"> <tr> <td align="center"><strong>Date of Event</strong></td> <td align="center"><strong>Course Name</strong></td> <td align="center"><strong>Event Name</strong></td> <td align="center"><strong>Total Score</strong></td> </tr> <?php if($PlayerDetail) { while($row = mysql_fetch_row($PlayerDetail)) { echo "<tr><td>"; echo date('M j, Y g:i a', strtotime($row['eventDateTime'])); echo "</td><td>"; echo $row['CourseName']; echo "</td><td>"; echo $row['eventName']; echo "</td><td>"; echo $row['totalScore']; echo "</td></tr>"; } while($row2 = mysql_fetch_array($PlayerDetail)) { echo "<tr><td>"; echo date('M j, Y g:i a', strtotime($row2['eventDateTime'])); echo "</td><td>"; echo $row2['CourseName']; echo "</td><td>"; echo $row2['eventName']; echo "</td><td>"; echo $row2['totalScore']; echo "</td></tr>"; } } ?> </table> all that is displaying on the page is the date "eventDateTime" in the table, and the echo'd player name at the top of the page, but nothing else. any ideas ? Link to comment https://forums.phpfreaks.com/topic/170164-solved-query-is-only-displaying-one-field-and-not-the-rest/ Share on other sites More sharing options...
kickstart Posted August 13, 2009 Share Posted August 13, 2009 Hi Nothing I can see directly, but you grab the first row only for $row_PlayerDetail, the loop round after that will be the 2nd row onwards and your last loop won't bring anything back All the best Keith Link to comment https://forums.phpfreaks.com/topic/170164-solved-query-is-only-displaying-one-field-and-not-the-rest/#findComment-897634 Share on other sites More sharing options...
egiblock Posted August 16, 2009 Author Share Posted August 16, 2009 Hi Nothing I can see directly, but you grab the first row only for $row_PlayerDetail, the loop round after that will be the 2nd row onwards and your last loop won't bring anything back All the best Keith thanks.. i'll have to look at it some more again tomorrow... i can get it sometimes to display the 1st record, and nothing else, and then the 2-whatever records another time, but not the first... so i'll have to check it out when i have a clear head. Link to comment https://forums.phpfreaks.com/topic/170164-solved-query-is-only-displaying-one-field-and-not-the-rest/#findComment-899294 Share on other sites More sharing options...
egiblock Posted August 19, 2009 Author Share Posted August 19, 2009 Hi Nothing I can see directly, but you grab the first row only for $row_PlayerDetail, the loop round after that will be the 2nd row onwards and your last loop won't bring anything back All the best Keith it was the $row compared to $row_playerdetail that threw me off. this code works.. <?php if($PlayerDetail) { echo "<tr><td>"; echo date('M j, Y g:i a', strtotime($row_PlayerDetail['eventDateTime'])); echo "</td><td>"; echo $row_PlayerDetail['CourseName']; echo "</td><td>"; echo $row_PlayerDetail['eventName']; echo "</td><td>"; echo $row_PlayerDetail['totalScore']; echo "</td></tr>"; } while($row = mysql_fetch_array($PlayerDetail)) { echo "<tr><td>"; echo date('M j, Y g:i a', strtotime($row['eventDateTime'])); echo "</td><td>"; echo $row['CourseName']; echo "</td><td>"; echo $row['eventName']; echo "</td><td>"; echo $row['totalScore']; echo "</td></tr>"; } ?> i also took out the first "where" statement, and i finally got it !!! thanks !!!!! 8) Link to comment https://forums.phpfreaks.com/topic/170164-solved-query-is-only-displaying-one-field-and-not-the-rest/#findComment-901519 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.