Split oracle fetched data into 4 columns

时间:2017-12-18 07:32:24

标签: php oracle

I have Select view from oracle which returns me 11 rows. I want to fetch data and print them into 4 columns. Should be like:

startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(getActivity(), textView, textView.getTransitionName()).toBundle());

Here is my code for 2 columns. But how to do it for 4 columns?

Also I do not understand why Item 1 Item 2 Item 3 Item 4 Item 5 Item 6 Item 7 Item 8 Item 9 Item 10 Item 11 Item 12 Item 13....... shows row count only after oci_num_rows

while(oci_fecth_data)

1 个答案:

答案 0 :(得分:1)

如果我理解正确的话,这应该是你想要的。当然你仍然可以添加div或类等内容。我想,我只是给你我的方法的骨架。

<?php
$stmt1 = oci_parse($conn, $query1);
oci_execute($stmt1);
$mssqlaray = array();
$index = 0;
while (($row1 = oci_fetch_array($stmt1, OCI_BOTH))) 
{
    $mssqlaray[$index] = $row1;
    $index++;
}

echo '<table>'."\n";
echo '<tr>'."\n";

for($i = 0; $i < count($mssqlaray); $i++)
{
    echo '<td>'.$mssqlaray[$i].'</td>';
    if(i == 3 || i == 7 || i == 11){
        echo '</tr>'."\n";
        echo '<tr>'."\n";
    }
}
echo '</tr>'."\n";
echo '</table>."\n";
?>