<?php
function ipod_menu(){
$items = array();
$items['ipod'] = array(
'title' => 'iPod',
'page callback' => 'show_data',
'access callback' => TRUE,
);
return $items;
}
function show_data(){
$query = db_select('data','d')->fields('d')->execute()->fetchAll();
$output = '<table><th>No</th><th>Name</th><th>Age</th><th>City</th></tr>';
$i = 1;
foreach($query as $key){
$output .= '<tr>';
$output .= '<td>'.$i++.'</td>';
$output .= '<td>'.$key->name.'</td>';
$output .= '<td>'.$key->age.'</td>';
$output .= '<td>'.$key->city.'</td>';
$output .= '</tr>';
}
$output .= '</table>';
return $output;
}
function ipod_menu(){
$items = array();
$items['ipod'] = array(
'title' => 'iPod',
'page callback' => 'show_data',
'access callback' => TRUE,
);
return $items;
}
function show_data(){
$query = db_select('data','d')->fields('d')->execute()->fetchAll();
$output = '<table><th>No</th><th>Name</th><th>Age</th><th>City</th></tr>';
$i = 1;
foreach($query as $key){
$output .= '<tr>';
$output .= '<td>'.$i++.'</td>';
$output .= '<td>'.$key->name.'</td>';
$output .= '<td>'.$key->age.'</td>';
$output .= '<td>'.$key->city.'</td>';
$output .= '</tr>';
}
$output .= '</table>';
return $output;
}
No comments:
Post a Comment