Contacts

[insert_php]

$mConn = new mysqli(“mysql.olyham.k7wwp.net”, “olyhamuser”, “OlyOlyHamFree”, “olyham”);

if ($mConn->connect_errno) {
echo “Internal Error SC1 in ” . $_SERVER[“PHP_SELF”];
die();
}
// Update Web Log
$mSQL = “INSERT INTO WebLog (LogDateTime, IPAddress, ClientAgent, WebPage, CallSign, PageRecID, PageRecID2) VALUES (NOW(), ?, ?, ?, ?, ?, ?);”;
$mStmt = $mConn->prepare($mSQL);
$mStmt->bind_param(“ssssss”, $_SERVER[“REMOTE_ADDR”], $_SERVER[“HTTP_USER_AGENT”], $_SERVER[“PHP_SELF”], $_SESSION[“UserID”], $mID, $mID2);
$mStmt->execute();
$mStmt->close();

echo “

“;

echo “

“;
echo “

“;

$mBreakSection = “”;
$mBreakPosition = “”;
$mBreakRowNumber = “”;
$mFirstSection = true;
$mFirstRow = true;
$mFirstPostision = true;

// Get existing Positions and list.
$mSQL = “SELECT FirstName, LastName, CallSign, HomePhone, MobilePhone, eMail, B.SectionNumber, RowNumber, ColumnNumber, Section, Position FROM OfficersAndCommitteeMembers O” .
” JOIN Members M ON O.MemberRecID = M.MemberRecID” .
” JOIN BoardAndCommitteePositions B ON O.BoardAndCommitteePositionRecID = B.BoardAndCommitteePositionRecID” .
” JOIN Membership N ON M.MembershipRecID = N.MembershipRecID” .
” JOIN BoardAndCommitteeSections S ON B.SectionNumber = S.SectionNumber ” .
” ORDER BY SectionNumber, RowNumber, ColumnNumber, PositionSequence;”;
$mStmt = $mConn->prepare($mSQL);
// $mStmt->bind_param(“s”, $mKey);
$mStmt->execute();
$mStmt->bind_result($sqlFirstName, $sqlLastName, $sqlCallSign, $sqlHomePhone, $sqlMobilePhone, $sqlEmail, $sqlSectionNumber, $sqlRowNumber, $sqlColumnNumber, $sqlSection, $sqlPosition);
while ($mStmt->fetch()) {
// Break in Section. Display Section Title
if ($sqlSection <> $mBreakSection) {
$mBreakSection = $sqlSection;
// A section break always implies a Row break and a Position break
$mBreakPosition = “”;
$mBreakRowNumber = “”;
$mFirstRow = true;
$mFirstPostision = true;
if ($mFirstSection) {
$mFirstSection = false;
}
else
{
// Last thing written is always a member of a position, so close out nested table
echo “

“;
echo “

“;
echo “

“;
}
// echo ““;
echo “

“;
echo ”

” . $sqlSection . “

“;
echo “

“;
}

// Each position is a one column table with the position title on the first row, and the members on subsequent table rows.
// Each position table is nested in the master table as a

// Each row break starts a new row in the master table.

// Each column has a nested one by table for the row.
// Build a one column nested table for each position.
// End row when column with a break in Row Number

// Break in Row. Start new table row
if ($sqlRowNumber <> $mBreakRowNumber)
{
$mBreakRowNumber = $sqlRowNumber;
// A row break always implies a Position break
$mBreakPosition = “”;
$mFirstPostision = true;
if ($mFirstRow) {
$mFirstRow = false;
}
else
{
// Last thing written is always a member of a position, so close out nested table
echo “

“;
echo “

“;
echo “

“;
}
// echo ““;
echo “

“;
}

// Break in Position, display Position Title.
if ($sqlPosition <> $mBreakPosition)
{
$mBreakPosition = $sqlPosition;
if ($mFirstPostision)
{
$mFirstPostision = false;
}
else
{
// Last thing written is always a member of a position, so close out nested table
echo “

“;
echo “

“;
}
// echo ““;
echo ”

“;
echo ”

“;
// First Position Record, so write position title.
echo ”

“;
echo ”

“;
echo ”

“;
}

// Display each member within the position
// echo ““;
echo ”

“;
if ($sqlEmail <> “”)
{
echo ”

“;
}
else {
echo ”

“;
}
echo ”

“;
}
// End Position Table (end of file is a logical position break
// echo ““;
echo “
” . $sqlPosition . “
” . $sqlFirstName . ” ” . $sqlLastName . “, ” . $sqlCallSign . “ ” . $sqlFirstName . ” ” . $sqlLastName . “, ” . $sqlCallSign . “

“;
echo “

“;

echo “

“;
$mStmt->close();
$mConn->close();
echo “

“;
echo “

“;
echo “
“;
[/insert_php}]