Jump to content

Table not showing the Last Record


Go to solution Solved by dmirsch,

Recommended Posts

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>
Link to comment
https://forums.phpfreaks.com/topic/281932-table-not-showing-the-last-record/
Share on other sites

  • Solution

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.