我需要将简单数据从数据库打印到特定块,我使用了下面给出的代码并输出了文本,但它不在指定的块中(hello_world)。
function hello_world_block_view($delta = '') {
$block = array();
if ($delta == 'hello_world') {
$sql = "SELECT Test_name FROM Test_table";
$result = db_query($sql);
$record = $result->fetch();
foreach ($record as $records) {
echo $records;
}
$block['subject'] = t('Hello world Subject');
$block['content'] = t('Need to print database content');
}
return $block;
}