gpt4 book ai didi

php - 从数据库填充数组

转载 作者:行者123 更新时间:2023-11-29 08:22:37 25 4
gpt4 key购买 nike

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

$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

最佳答案

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

$data = array();

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

关于php - 从数据库填充数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18929713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com