我使用以下代码将数据从WordPress SQL数据库提取到数组......
global $wpdb;
$blogusers = get_users('blog_id=1&orderby=nicename&role=seller');
foreach ($blogusers as $user) {
$count = $wpdb->get_results("SELECT COUNT(*) as count FROM wp_mymeta1 WHERE value='$user->user_login'");
$total = $count[0]->count;
$arrData=array("Seller"=>"$user->user_login","Total"=>"$total");
$arrRtn=array();
array_push($arrRtn, $arrData);
print_r($arrRtn);
}
它返回以下数组....
Array ( [0] => Array ( [Seller] => 76 [Total] => 989 ) )
Array ( [0] => Array ( [Seller] => 33 [Total] => 765 ) )
Array ( [0] => Array ( [Seller] => 93 [Total] => 743 ) )
但我试图将数据放在一个看起来像这样的数组中......
var $example_data = array(
array(
'Seller' => '76',
'Total' => '989'
),
array(
'Seller' => '33',
'Total' => '765'
),
array(
'Seller' => '93',
'Total' => '743'
),
);
我哪里错了?