Splitting Arrays in Half

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I have the following code and here is my goal:

I have an array and right now, as the code stands, I have one column of data
on a page.  I want it to have 2 colums of data on a page.  I have tried this
and it just returns blank so I am asking for some help.  Thank you in
advance and I will be here for any questions you have.

Thanks Again,
Jacob



   $total_count = 0;
    $display_count = 0;
    
    //Do for each item
    foreach ($item as $sched)
        {
        /*    $total_count++;
            $sched[] = array( 'teama' => $item[teama],
                              'teamb' => $item[teamb],
                             'scorea' => $item[scorea],
                             'scoreb' => $item[scoreb]);
                   
        }
    while ($total_count < $display_count)
    {
        if ($display_count != "0") next($sched);*/
        //Start the Row
         $output->TableRowStart();

        // Get the team name given its ID
        $tma = pnModAPIFunc('Standings','user','getteam',array('tid' =>
$sched[teama]));
        $tmb = pnModAPIFunc('Standings','user','getteam',array('tid' =>
$sched[teamb]));
        $col1 = $vars['color1'];

        // Home is the first team or the second?
        $rev = $vars['reversed'];
        if ($rev == 1) {
           $loc = $tmb[city];
           $field = $tmb[paddress];
        } else {
           $loc = $tma[city];
           $field = $tma[paddress];
        }

        if ($sched[scorea] == "-1")
                {
                    $sched[scorea] = "NA";
                }
        if ($sched[scoreb] == "-1")
            {
                $sched[scoreb] = "NA";
            }
        $output->Text("<td>");
            $output->Text("<table width='200'>");
                $output->Text("<tr>");
                    $output->Text("<td>");
                        $output->Text("<div align=\"left\"><font
size=1>&nbsp;".$tma[team]." ($sched[scorea])</font></div");
                    $output->Text("</td>");
                    $output->Text("<td bgcolor='$col1' width='100'>");
                        $output->Text("<font color=#0000FF
size='1'></font>");
                    $output->Text("</td>");
                   $output->Text("</tr>");
                $output->Text("<tr>");
                    $output->Text("<td>");
                        $output->Text("<div align=\"left\"><font
size=1>&nbsp;".$tmb[team]." ($sched[scoreb])</font></div>");
                    $output->Text("</td>");
                    $output->Text("<td bgcolor='$col1' width='100'>");
                        $output->Text("<font color=#0000FF size='1'><div
align=\"right\"><a title='$field'>$loc</a></div</font>");
                    $output->Text("</td>");
            $output->Text("</table>");
        $output->Text("</td>");
        
     /*   $display_count++;
        next($sched);
       while($total_count < $display_count)
           {
               
                // Get the team name given its ID
                $tma = pnModAPIFunc('Standings','user','getteam',array('tid'
=> $sched['teama']));
                $tmb = pnModAPIFunc('Standings','user','getteam',array('tid'
=> $sched['teamb']));
                
                //Get the COlors
                $col1 = $vars['color1'];
        
                // Home is the first team or the second?
                $rev = $vars['reversed'];
                if ($rev == 1)
                    {
                           $loc = $tmb[city];
                           $field = $tmb[paddress];
                    }
                else
                    {
                           $loc = $tma[city];
                           $field = $tma[paddress];
                    }

                if ($sched[scorea] == "-1")
                    {
                        $sched[scorea] = "NA";
                    }
                if ($sched[scoreb] == "-1")
                    {
                        $sched[scoreb] = "NA";
                    }
                $output->Text("<td>");
                    $output->Text("<table>");
                        $output->TableRowStart();
                            $output->TableColStart(1,left);
                                $output->Text("<font
size=1>&nbsp;".$tma[team]." ($sched[scorea])</font>");
                            $output->TableColEnd();
                            $output->Text("<td bgcolor='$col1'
align='center' valign='middle' width='80'>");
                                $output->Text("<font color=#0000FF
size='1'></font>");
                            $output->TableColEnd();
                           $output->TableRowEnd();
                        $output->TableRowStart();
                            $output->TableColStart(1,left);
                                $output->Text("<font
size=1>&nbsp;".$tmb[team]." ($sched[scoreb])</font>");
                            $output->TableColEnd();
                            $output->Text("<td bgcolor='$col1'
align='center' valign='middle' width='80'>");
                                $output->Text("<font color=#0000FF
size='1'><a title='$field'>$loc</a></font>");
                            $output->TableColEnd();
                    $output->Text("</table>");
                $output->Text("</td>");
                $display_count++;
            }*/
        
        
        //End the Row
        $output->TableRowEnd();


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux