dmirsch Posted September 6, 2013 Share Posted September 6, 2013 I have created PHP coding that pulls records from a MySQL database. It works fine, EXCEPT that it does not display the last person's position (acronym) and name (officer). It does however pull the chapters for that person. Here is the webpage where it is displayed: http://mnwt.org/exec-council/execcouncil_dd-home.php Please help me figure it out. Here is the coding: <table align="center" width="100%"><tr> <?php $Query = "SELECT * FROM execCouncil LEFT JOIN positions ON execCouncil.acronym = positions.acronym WHERE execCouncil.endDate > now() AND positions.pos ='DD' ORDER BY execCouncil.ecID"; $Result = mysqli_query($DB,$Query); $NumResults = mysqli_num_rows($Result); $c = 0; // Our counter $n = 2; // Each Nth iteration would be a new table row while ($Row = mysqli_fetch_assoc($Result)){ if($c % $n == 0 && $c != 0 && $Row['acronym'] != 'PRES') // If $c is divisible by $n... { // New table row echo '</tr><tr>'; } $c++; if ($Row['acronym']!='CSC'){ echo '<td width="50%" valign="top">'; if ($Row['photo'] != NULL){ echo '<h2>'.$Row['title'].': <a href="mailto:'.strtolower($Row['emailAddress']).'">'.$Row['officer'].'</a></h2>'; echo '<img src="/images/exec-council/'.strtolower($Row['acronym']).'.jpg" alt="'.$Row['officer'].', '.$Row['title'].'" title="'.$Row['officer'].', '.$Row['title'].'" width="100" align="left" />'; } $dDirector = $Row['officer']; } ?> <?php echo '<blockquote><blockquote><ul>'; $chptrQuery = "SELECT * FROM chapters LEFT JOIN execCouncil ON chapters.districtNumber = execCouncil.acronym WHERE execCouncil.officer='$dDirector' ORDER BY execCouncil.acronym, chapters.wtChapter"; $chptrResult = mysqli_query($DB,$chptrQuery); $chptrNumResults = mysqli_num_rows($chptrResult); while ($chptrRow = mysqli_fetch_assoc($chptrResult)){ echo '<li>'.$chptrRow['wtChapter']; if ($chptrRow['websiteURL'] != NULL){ echo '<a href="'.$chptrRow['websiteURL'].'" target="_blank"><img src="/images/icons/website.gif" alt="'.$chptrRow['wtChapter'].' website" title="'.$chptrRow['wtChapter'].' website" width="10" border="0" align="top" /></a>'; } if ($chptrRow['facebookURL'] != NULL){ echo '<a href="'.$chptrRow['facebookURL'].'" target="_blank"><img src="/images/icons/facebook.png" alt="'.$chptrRow['wtChapter'].' Facebook page" title="'.$chptrRow['wtChapter'].' Facebook page" width="10" border="0" align="top" /></a>'; } echo '</li>'; } echo '</ul></blockquote></blockquote>'; } echo '</td>'; ?> <td width="50%" height="0" align="center"><a href="/pdfs/officers/cob_DistrictMap.pdf" target="_blank"><img src="/images/exec-council/stuff4site/2013DistrictMap.gif" alt="2013 District Map" title="2013 District Map" height="150" border="0" /></a></td></tr></table> Quote Link to comment https://forums.phpfreaks.com/topic/281932-table-not-showing-the-last-record/ Share on other sites More sharing options...
requinix Posted September 6, 2013 Share Posted September 6, 2013 Considering how it works for every other person, have you tried checking if the data itself is wrong? Quote Link to comment https://forums.phpfreaks.com/topic/281932-table-not-showing-the-last-record/#findComment-1448498 Share on other sites More sharing options...
Solution dmirsch Posted September 6, 2013 Author Solution Share Posted September 6, 2013 OK, thanks requinix! Duh! data is missing on the last record. For some reason, I thought it was just remming out the last record....no issue here, but my own failure to check the data. Lesson Learned! Quote Link to comment https://forums.phpfreaks.com/topic/281932-table-not-showing-the-last-record/#findComment-1448518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.