Login

Generate Report

 function _get_color_vote() {
 
    $header = array("Color Name","Vote Count");
    $vars = array();
    $vars['attributes'] = array('style'=>'width:25%;border: solid black 2px;','cellpadding'=>3,'cellspacing' =>3);
    $vars['caption'] = 'Color Election';
    $vars['header']=$header;
    $vars['colgroups'] = NULL;
    $vars['sticky'] = NULL;
    $vars['empty'] = NULL;
 
    $rows['data'] = array();
    $db = new dbMy_color();
    try
    {
        $data_rows = $db->getCountByColor();
        $table_rows = array_merge($rows, $data_rows);
        $vars['rows']=$table_rows;
 
    } catch(Exception $e) {
        $data = array('No Data','No Data');
        $data[0] = array('red','0');
        $data[1] = array('white','0');
        $data[2] = array('blue','0');
 
        $table_rows = array_merge($rows,$data);
        $vars['rows']=$table_rows;
    }
    return $vars;
 }