Skip to main content
Fix code formatting
Source Link

Use this code:

/******************************************/

$header = array(
        array('data' => 'title',        'field' => 'title', 'sort' => 'ASC'),
        array('data' => 'cal name 1',   'field' => 'field_order_value'),
        array('data' => 'Cal name 2',   'field' => 'field_issue_value'),
    );

// $result = db_query("SQL here");

$rpt_data = array();

    foreach ($results as $key => $rpt_data1){
        $rpt_data[$key][] = 'Result item';
        $rpt_data[$key][] = $rpt_data1->product_title;
        $rpt_data[$key][] = $rpt_data1->stock_value;
    }
  
    if (count($rpt_data) == 0) {
        $output = t('<div class="no-data">Record not found.</div>');
    } else {
        $per_page = 20; // Initialize the pager
        $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
        $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
        $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
        $output.= theme('pager', array('quantity',count($rpt_data)));
    }

Use this code:

/******************************************/

$header = array(
        array('data' => 'title',        'field' => 'title', 'sort' => 'ASC'),
        array('data' => 'cal name 1',   'field' => 'field_order_value'),
        array('data' => 'Cal name 2',   'field' => 'field_issue_value'),
    );

// $result = db_query("SQL here");

$rpt_data = array();

    foreach ($results as $key => $rpt_data1){
        $rpt_data[$key][] = 'Result item';
        $rpt_data[$key][] = $rpt_data1->product_title;
        $rpt_data[$key][] = $rpt_data1->stock_value;
    }
  
    if (count($rpt_data) == 0) {
        $output = t('<div class="no-data">Record not found.</div>');
    } else {
        $per_page = 20; // Initialize the pager
        $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
        $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
        $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
        $output.= theme('pager', array('quantity',count($rpt_data)));
    }
$header = array(
        array('data' => 'title',        'field' => 'title', 'sort' => 'ASC'),
        array('data' => 'cal name 1',   'field' => 'field_order_value'),
        array('data' => 'Cal name 2',   'field' => 'field_issue_value'),
    );

// $result = db_query("SQL here");

$rpt_data = array();

    foreach ($results as $key => $rpt_data1){
        $rpt_data[$key][] = 'Result item';
        $rpt_data[$key][] = $rpt_data1->product_title;
        $rpt_data[$key][] = $rpt_data1->stock_value;
    }
  
    if (count($rpt_data) == 0) {
        $output = t('<div class="no-data">Record not found.</div>');
    } else {
        $per_page = 20; // Initialize the pager
        $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
        $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
        $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
        $output.= theme('pager', array('quantity',count($rpt_data)));
    }

Use this code:

enter/******************************************/

$header code= herearray(

/******************************************/

$header = array( array('data' => 'title', 'field' => 'title', 'sort' => 'ASC'), array('data' => 'cal name 1', 'field' => 'field_order_value'), array('data' => 'Cal name 2', 'field' => 'field_issue_value'), );

// $result = db_query("SQL here");

$rpt_data = array();

        array('data' => 'title',        'field' => 'title', 'sort' => 'ASC'),
        array('data' => 'cal name 1',   'field' => 'field_order_value'),
        array('data' => 'Cal name 2',   'field' => 'field_issue_value'),
    );

// $result = db_query("SQL here");

$rpt_data = array();

    foreach ($results as $key => $rpt_data1){
        $rpt_data[$key][] = 'Result item';
        $rpt_data[$key][] = $rpt_data1->product_title;
        $rpt_data[$key][] = $rpt_data1->stock_value;
    }
  
    if (count($rpt_data) == 0) {
        $output = t('<div class="no-data">Record not found.</div>');
    } else {
        $per_page = 20; // Initialize the pager
        $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
        $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
        $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
        $output.= theme('pager', array('quantity',count($rpt_data)));
    }

Use this code

enter code here

/******************************************/

$header = array( array('data' => 'title', 'field' => 'title', 'sort' => 'ASC'), array('data' => 'cal name 1', 'field' => 'field_order_value'), array('data' => 'Cal name 2', 'field' => 'field_issue_value'), );

// $result = db_query("SQL here");

$rpt_data = array();

foreach ($results as $key => $rpt_data1){
    $rpt_data[$key][] = 'Result item';
    $rpt_data[$key][] = $rpt_data1->product_title;
    $rpt_data[$key][] = $rpt_data1->stock_value;
}

if (count($rpt_data) == 0) {
    $output = t('<div class="no-data">Record not found.</div>');
} else {
    $per_page = 20; // Initialize the pager
    $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
    $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
    $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
    $output.= theme('pager', array('quantity',count($rpt_data)));
}

Use this code:

/******************************************/

$header = array(
        array('data' => 'title',        'field' => 'title', 'sort' => 'ASC'),
        array('data' => 'cal name 1',   'field' => 'field_order_value'),
        array('data' => 'Cal name 2',   'field' => 'field_issue_value'),
    );

// $result = db_query("SQL here");

$rpt_data = array();

    foreach ($results as $key => $rpt_data1){
        $rpt_data[$key][] = 'Result item';
        $rpt_data[$key][] = $rpt_data1->product_title;
        $rpt_data[$key][] = $rpt_data1->stock_value;
    }
  
    if (count($rpt_data) == 0) {
        $output = t('<div class="no-data">Record not found.</div>');
    } else {
        $per_page = 20; // Initialize the pager
        $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
        $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
        $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
        $output.= theme('pager', array('quantity',count($rpt_data)));
    }
Source Link

Use this code

enter code here

/******************************************/

$header = array( array('data' => 'title', 'field' => 'title', 'sort' => 'ASC'), array('data' => 'cal name 1', 'field' => 'field_order_value'), array('data' => 'Cal name 2', 'field' => 'field_issue_value'), );

// $result = db_query("SQL here");

$rpt_data = array();

foreach ($results as $key => $rpt_data1){
    $rpt_data[$key][] = 'Result item';
    $rpt_data[$key][] = $rpt_data1->product_title;
    $rpt_data[$key][] = $rpt_data1->stock_value;
}

if (count($rpt_data) == 0) {
    $output = t('<div class="no-data">Record not found.</div>');
} else {
    $per_page = 20; // Initialize the pager
    $current_page = pager_default_initialize(count($rpt_data), $per_page);  // Split your list into page sized chunks
    $chunks = array_chunk($rpt_data, $per_page, TRUE);  // Show the appropriate items from the list
    $output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page])); // Show the pager
    $output.= theme('pager', array('quantity',count($rpt_data)));
}