如何从db获取特定行 [英] How to get specific rows from db
本文介绍了如何从db获取特定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello社区,
我想从我的Wordpress数据库中获取特定行到购物车页面...
到目前为止我使用的这行
Hello Community,
I am trying to get a specific row from my Wordpress database into the Cart page...
So far i am using this line
<?php $brands = get_terms(); print_r($brands);?>
它为我提供了一个完整列表,其中包含数组:
it gets me a full list with array's like:
[78] => WP_Term Object ( [term_id] => 1 [name] => Uncategorized [slug] => uncategorized [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [filter] => raw ) [79] => WP_Term Object ( [term_id] => 142 [name] => USED ITEM [slug] => used-item [term_group] => 0 [term_taxonomy_id] => 142 [taxonomy] => product_brand [description] => [parent] => 0 [count] => 404 [filter] => raw )
我的目标是只打印
My goal is to print only this
[name] => USED ITEM
并非所有其他阵列也是如此。
我尝试过:
i试图把$ brands =>名称但是它给了我错误。
not all other array aswell.
What I have tried:
i have tried to put $brands=>name but it gives me error.
推荐答案
brands = get_terms(); print_r(
brands = get_terms(); print_r(
品牌);?>
它为我提供了一个包含数组的完整列表:
it gets me a full list with array's like:
[78] => WP_Term Object ( [term_id] => 1 [name] => Uncategorized [slug] => uncategorized [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [filter] => raw ) [79] => WP_Term Object ( [term_id] => 142 [name] => USED ITEM [slug] => used-item [term_group] => 0 [term_taxonomy_id] => 142 [taxonomy] => product_brand [description] => [parent] => 0 [count] => 404 [filter] => raw )
我的目标是只打印
My goal is to print only this
[name] => USED ITEM
并非所有其他阵列也是如此。
我尝试过:
i试图将
not all other array aswell.
What I have tried:
i have tried to put
brands =>名称但它给我错误。
brands=>name but it gives me error.
这篇关于如何从db获取特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文