我想获取表1中 {
"_id": "ef430891-f530-48c1-bbb7-d634f3e8a726",
"name": "Ronaldinho",
"teamId": "80",
"link": "",
"nationality": ""
},
{
"_id": "5474f09b-b022-467d-8146-7bb209c8213c",
"name": "Ron-Robert Zieler",
"teamId": "14",
"link": "",
"nationality": ""
},
{
"_id": "31df32ca-f82f-4065-9a0c-e7f5dfca6975",
"name": "Ronald Zubar",
"teamId": "161",
"link": "",
"nationality": ""
},
{
"_id": "95ce7b70-9fd0-4fd0-94df-f2aa19c86014",
"name": "Connor Ronan",
"teamId": "161",
"link": "",
"nationality": ""
},
{
"_id": "3a5a03d0-ae12-4d7e-a65a-046d212f96b5",
"name": "Ronald Zubar",
"teamId": "161",
"link": "",
"nationality": ""
},
{
"_id": "d364ed8b-08eb-44b3-86c2-36a020aa286a",
"name": "Ronny Philp",
"teamId": "1730",
"link": "",
"nationality": ""
},
{
"_id": "a2669331-b895-474f-b66e-6a470f085d33",
"name": "Ronny Philp",
"teamId": "1730",
"link": "",
"nationality": ""
},
{
"_id": "d57ace5d-d600-43b1-b581-0198b729a232",
"name": "Facundo Roncaglia",
"teamId": "62",
"link": "",
"nationality": ""
},
{
"_id": "b9a37eb9-55a2-44fe-9528-8939e7a98068",
"name": "Ronaldo",
"teamId": "272",
"link": "",
"nationality": ""
},
{
"_id": "e5e91af5-2a4a-45af-8a8a-86ac2a6015f1",
"name": "Ronny Garbuschewski",
"teamId": "1150",
"link": "",
"nationality": ""
},
{
"_id": "ba3c1419-3893-41a3-89e1-82552578339e",
"name": "Ronny",
"teamId": "47",
"link": "",
"nationality": ""
},
{
"_id": "97ab6cb1-efa9-4be1-b54a-bc9ec4ab26e9",
"name": "Ronny",
"teamId": "47",
"link": "",
"nationality": ""
},
{
"_id": "dc1cd084-191d-4580-95ae-bcc4192dd3ac",
"name": "Cristiano Ronaldo",
"teamId": "52",
"link": "",
"nationality": ""
},
{
"_id": "8d0de3bf-4ed7-4964-8c9a-f47c5422993c",
"name": "Ronan Le Crom",
"teamId": "304",
"link": "",
"nationality": ""
},
{
"_id": "6d9606f0-af76-4ca1-a5ca-42e27bd9d0ba",
"name": "Ronael Pierre Gabriel",
"teamId": "145",
"link": "",
"nationality": ""
},
{
"_id": "2eb213ea-b5a8-4584-9459-c4fcfed26e0d",
"name": "Ronael Pierre Gabriel",
"teamId": "145",
"link": "",
"nationality": ""
}
列的值parent_affiliate_id
,将其存储在affiliate_id = $get_id
中并显示它。
我是WordPress的新手。请帮我。预先谢谢你
$parent_traced_id
答案 0 :(得分:0)
在代码中,您将值存储在名为“ parent_traced_id”的变量中,它将仅存储将循环的最后一个值。您可以使用数组而不是变量,因此它将存储将在for循环中循环的所有值。并且您正在使用echo“ $ parent_traced_id”显示变量;使用echo $ parent_traced_id。要显示所有值,请使用print_r($ parent_traced_id)。
global $wpdb;
$table1 = $wpdb->prefix . "users";
$results = $wpdb->get_results("SELECT *
FROM ".$table1);
foreach($results as $row){
$row_id[] = $row->ID;
}
print_r($row_id);