Forum Moderators: coopster
I'm hoping some of the great folks here have experienced something along the lines of "breaks" while displaying query results before.
I'm pulling a series of fields from 2 tables based on a join. The fields are Name, AcctNum, Crate, Fees, Disc & Total. I then print them in a table but I want to create a divider when the AcctNum changes. I'm pulling it out of MySQL with an "Order By" option so that all entries with the same AcctNum are together but can't seem to get to causing a break/divider when that number/field changes.
Any advice?
$var = "";
while ($row = mysql_fetch_array()) {
if ($row['AcctNum']!== $var) do_something();
show_data();
$var = $row['AcctNum'];
}
$var is the value you want to check. Each time it takes a row from the database, it checks the value of $var against that row's 'AcctNum'. If it's different, output a divider or whatever you want (do_something()). It then shows the data and sets the value of $var to the current 'AcctNum'.
Hope it works for you,
Alex ...