我有一个如下所示的SQL查询
CREATE TABLE IF NOT EXISTS `breakup` (
`id` int(7) NOT NULL AUTO_INCREMENT,
`ORDEST` varchar(20) DEFAULT NULL,
`ORDEL` varchar(10) DEFAULT NULL,
`ORPATT` varchar(15) DEFAULT NULL,
`ORITEM` varchar(15) NOT NULL,
`ORZPC` int(7) NOT NULL,
`ORPKG` int(7) NOT NULL,
PRIMARY KEY (`id`),
KEY `ORDEST` (`ORDEST`),
KEY `ORITEM` (`ORITEM`),
KEY `ORPATT` (`ORPATT`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=96 AUTO_INCREMENT=9 ;
--
-- Dumping data for table `breakup`
--
INSERT INTO `breakup` (`id`, `ORDEST`, `ORDEL`, `ORPATT`, `ORITEM`, `ORZPC`, `ORPKG`) VALUES
(1, 'COLOMBO', '20170402', '000M305', '95815', 2000, 2000),
(2, 'MM', '20170405', 'Z0505', '50968BA', 100, 100),
(3, 'MM', '20170407', 'Z3481', '91123', 1, 1),
(4, 'MM', '20170407', 'Z3481', '91127', 1, 1),
(5, 'MM', '20170407', 'Z3481', '91128', 1, 1),
(6, 'MM', '20170407', 'Z3481', '91987S', 6, 1),
(7, 'MM', '20170407', 'Z3481', '91189C', 6, 1),
(8, 'COLOMBO', '20170415', 'Z0505', '55506', 972, 972);
然后我需要通过以上数据来生成像这样的php报告;我已多次尝试并以错误结束。
谢谢
用于表格标题打印的php代码;
<?php
$sql_e=mysql_query(
"SELECT * FROM breakup
GROUP By ORDEL, ORDEST
ORDER BY ORDEL, ORDEST"
)
or die ("err 120");
while ($row_e = mysql_fetch_array($sql_e)) {
$dest=$row_e['ORDEST'];
$ordel=$row_e['ORDEL'];
echo '<td align="center" bgcolor="#CCCCCC" width="150"><b> '.$ordel."<br>". $dest.' </b></td>';
}
?>