问题描述
我想创建一个带有PHP变量的关联数组(文章ID)
作为Key
和另一个关联数组,因为它的价值。
如何实现它,我该如何填充它?
我想要一些东西像这样:
$ articleTable = array($ articleNr => array(" name" => $ name," price" =>
$ price,amount=> 0);
(金额将在稍后的表格中填写。)
最后我想要一个包含来自
数据库的数据的数组,
这样的东西:
ArticleNr ArticleName价格金额
12345牙齿布鲁斯10 3
24939东西2 1
19492牙膏8 0
29491水1 4
那怎么办呢?
谢谢,
Stefan
Hi,
I want to create an associative Array with a PHP variable (article ID)
as Key
and another associative array as it''s value.
How do I instanciate it, how can I fill it?
I want something like this:
$articleTable= array( $articleNr => array("name" => $name, "price " =>
$price ,"amount" => 0 );
( Amount will be filled later in a form.)
At the end I want an Array that contains data coming from the
database,
something like this:
ArticleNrArticleNamePriceAmount
12345 tooth bruth103
24939stuff21
19492tooth paste80
29491water14
So how can this be done?
Thanks,
Stefan
这篇关于关联数组,ID为Key,其他关联数组为值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!