I am sure the title is not even right on this one.
Here is the issue , I have 3 columns and 6 results
that are displayed like this
Column1 Column2 Column3
result1 result3 result5
result2 result4 result6
but need them like this
Column1 Column2 Column3
result1 result2 result3
result4 result5 result6
my array holds all 6 results and so far I see I need to pick every 0 and 2nd to be displayed in column1 and continue( array starts at 0).
the code is pretty large but the main part for switching results is here
$count = count($result);
for ($result = 0; $result < $count; $result++) {
$getorder= "";
if ($count != 1) {
if ($result == 0) $getorder= "first";
if ($result == $count - 1) $getorder= "last";
}
echo '<div class="'.$getorder.'width'.intval(100 / $count).'">'.$mycolumn[$result].'</div>';
}
so this here should have some kind of division. Here is just dumb example
$mycolumn[$result % X == X]
i hope I did not confuse you and you get the idea. If you ask yourself why i don’t just do rows instead columns , answer is complete css reconstructions. whit this here figured out I can target the results and keep columns and css as they are
Don’t use
($result / 3)since you can have seriuous rounding problem.Since to me it’s not very clear the name of your vars I post you a php generic code and it is:
Just change the vars name with your needs and this is the solution to your problem.