Best Way To Proceed
Hello,
This is not about an error, so no real need--or urgency to--respond.
I do not like amending code for my needs or purposes, because only being a relatively unfamiliar amateur, it leads to errors. The "while" statement the MySQLi extension placed on my page did not give me enough control over the output. I found that I instead needed a do-while loop. I first had to create my solution procedurally elsewhere, and then gradually adapt to object-oriented.
Here is the solution I came up with:
<?php if ($mySaturdayClasses->TotalRows > 0) { // Show if mysqli recordset not empty ?>
<p><span class="cancelledtext">Classes held on:
<?php
$previous = date('M');
echo "<strong>";
echo $previous;
echo "</strong>";
$wa_startindex = $mySaturdayClasses->Index;
do {
if (!(date('M', strtotime($mySaturdayClasses->getColumnVal("classdate"))) == $previous))
{
echo "<strong>";
echo "| ";
echo date('M', strtotime($mySaturdayClasses->getColumnVal("classdate")));
echo "</strong>";
$previous = date('M', strtotime($mySaturdayClasses->getColumnVal("classdate")));
}
echo " " . date('jS', strtotime($mySaturdayClasses->getColumnVal("classdate")));
?>
<?php $mySaturdayClasses->moveNext();
} while (!$mySaturdayClasses->atEnd()) ; ?>
<?php $mySaturdayClasses->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount); ?>
</span></p>
<?php } // Show if mysqli recordset not empty ?>
That solution was based on this query (generated by MySQLi):
<?php
$mySaturdayClasses = new WA_MySQLi_RS("mySaturdayClasses",$mysqli_workshops,0);
$mySaturdayClasses->setQuery("SELECT * FROM workshops.saturdayssundays WHERE (saturdayssundays.classdate BETWEEN (DATE_ADD(CURDATE(), INTERVAL 0 MONTH)) AND (DATE_ADD(CURDATE(), INTERVAL 5 MONTH))) AND (WEEKDAY(saturdayssundays.classdate)=5) ORDER BY saturdayssundays.classdate");
$mySaturdayClasses->execute();
?>
I just want to know if there was a way to achieve the same end ENTIRELY using WebAssist tools, and that I somehow missed. I have some more complex tasks I must accomplish that will appear later in this project, and if I can avoid hand-coding to minimize my risks, that is what I would prefer.
Thank you,
KAB