Re: array_slice() - sometimes has errors when total records isnot even amount
| From: | Christoph Becker | Date: | Sat, 25 Apr 2015 01:26:46 +0000 |
| Subject: | Re: array_slice() - sometimes has errors when total records isnot even amount | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324825@lists.php.net to get a copy of this message | ||
Bastien Koert wrote:
> The easiest approach is to do a modulus check on the size of the result and
> figure out if you need a blank cell at the end
>
> $finish = '';
> if($allrows %2 !=0){ $finish = "<div
> id='empty'> </div>"; }
>
> //echo out divs
>
> echo $finish;
Perhaps even simpler(?): use CSS for the presentation, and don't bother
splitting up the result set.
--
Christoph M. Becker