0

我需要从数据库中填充一个数组,但必须采用以下格式:

$rows = array(         
   array("WD", "80GB","WD800AAJS SATA2 7200rpm 8mb"        ,"$36.90","Y"),
   array("WD","160GB","WD1600AAJS SATA300 8mb 7200rpm"     ,"$39.87","Y"),
   array("WD", "80GB","800jd SATA2 7200rpm 8mb"            ,"$41.90","Y"),
   array("WD","250GB","WD2500AAKS SATA300 16mb 7200rpm"    ,"$49.88","Y"),
   array("WD","320GB","WD3200AAKS SATA300 16mb 7200rpm"    ,"$49.90","Y"),
   array("WD","160GB","1600YS SATA raid 16mb 7200rpm"      ,"$59.90","Y"),
   array("WD","500GB","500gb WD5000AAKS SATA2 16mb 7200rpm","$64.90","Y"),
   array("WD","250GB","2500ys SATA raid 7200rpm 16mb"      ,"$69.90","Y"),
);

我正在这样做,但它不起作用

$data = array();

foreach ($res as $value) {
    $data[] = array('afiliadios'=>
        array(
            $value[noEmpadronamiento],
            $value[docIdentificacion],
            $value[municipio],
            $value[departamento],
            $value[fechaAfiliacion],
            $value[apellido],
            $value[nombre])
        );
}

我想以 pdf 格式进行报告,这是我正在引导的链接

http://www.zedwood.com/article/136/generate-pdfs-with-php

4

1 回答 1

2

如果你想生成类似的数组,那么它应该是这样的。

$data = array();

foreach ($res as $value) {
    $data[] =  array(
            $value['noEmpadronamiento'],
            $value['docIdentificacion'],
            $value['municipio'],
            $value['departamento'],
            $value['fechaAfiliacion'],
            $value['apellido'],
            $value['nombre'])
        );
}
于 2013-09-21T06:43:20.700 回答