<?php
while($row2 = mysql_fetch_array($result)){
$object_id = $row2['object_id'];
$sql ="select term_taxonomy_id from wp_term_relationships where object_id =
$object_id";
$results = mysql_query($sql);
while($row3 = mysql_fetch_array($results)){
$term_taxonomy_id1[] = $row3['term_taxonomy_id']."<br/>";
}
}
print_r($term_taxonomy_id1);
?>
使用上述代码后,我在数组中获取了 term_taxonomy_id
Array (
[0] => 249
[1] => 250
[2] => 251
[3] => 252
[4] => 250
[5] => 251
[6] => 254
)
我想获取 term_id(基于类别、品牌和设计师中的拆分分类列)
这是表结构
表:wp_term_taxonomy
我需要这样的输出
Array
(
[category] => Array
(
[0] => 177
[1] => 179
)
[brand] => Array
(
[0] => 176
)
[designer] => Array
(
[0] => 175
[1] => 180
)
)