Hi, i would like to show the table tile on every 11th row of data. eg. show table title on the row 11, 21, 31, 41, 51, 61, 71, ........ How can i do that? Many thanks for guidance. regards
Have a look at the modulus operator:
http://php.net/manual/en/language.operators.arithmetic.php
<?php $count = 1; $title = "This is a title row - replace with a table if that's what your doing"; $rows = array(); // assume this is the data you are displaying foreach ($rows as $val) { echo ($count % 10) ? $title : ''; // The above is equiv to: if (($count / 10) == 0) { echo $title; } echo $val; // display your data - again if table you should know what to do. $count++; // increase count } ?>
That is one common use of the modulus operator.
MANY THANKS, I'LL TRY IT OUT NOW 🙂