0
我需要從數據庫打印一個簡單的數據到一個特定的塊,我已經使用了下面給出的代碼並獲得了文本輸出,但它不在指定的塊中(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;
}