Php implements the function of exporting data categories and merging cells
1
12Information Statistics table131415Unit16Owner17181920'; 21 while ($ row = mysql_fetch_array ($ result) {22 $ gw = explode (",", $ row ['gw ']); 23 echo '2425'. $ Row ['danwei'].'26'. Iconv ("gbk", "UTF-8", $ gw [0]).'2728'; 29 if ($ row ['num']> 1) {30 for ($ I = 1; $ I <$ row ['num']; $ I ++) {31 echo''. Iconv ("gbk", "UTF-8", $ gw [$ I]).''; 32} 33} else {34 35} 36 37} 38 39 echo '404142'; 43?>
1 create table if not exists 'dy '(2 'id' int (11) unsigned not null AUTO_INCREMENT, 3 'danwei' varchar (30) not null, 4 'fuze' varchar (30) not null, 5 primary key ('id') 6) ENGINE = MyISAM default charset = gbk AUTO_INCREMENT = 7; 7 8 -- 9 -- insert into 'dy '('id', 'danwei', 'fuze') VALUES13 (1, 'A', 'Zhang '), 14 (2, 'A', 'grandchildren'), 15 (3, 'B', 'Wang '), 16 (4, 'C', 'Lily'), 17 (5, 'A', 'xiaohong'), 18 (6, 'B', 'Zhao ');
Function preview: