我试图从php文件中获取数据库中的数据

时间:2017-05-22 16:45:07

标签: php mysql wordpress

我是wordpress的新手,无法找到从数据库中获取数据的方法。 我已经设置了一个新的php文件。 我正在使用主题页面中的代码在新文件中获得相同的方式.php

ERRATA_PKG_LIST = [u'kernel-2.6.18-416.el5.i686', u'kernel-2.6.18-416.el5.x86_64', u'kernel-debug-2.6.18-416.el5.i686', u'kernel-debug-2.6.18-416.el5.x86_64', u'kernel-debug-devel-2.6.18-416.el5.i686', u'kernel-debug-devel-2.6.18-416.el5.x86_64', u'kernel-devel-2.6.18-416.el5.i686', u'kernel-devel-2.6.18-416.el5.x86_64', u'kernel-doc-2.6.18-416.el5.noarch', u'kernel-headers-2.6.18-416.el5.i386', u'kernel-headers-2.6.18-416.el5.x86_64', u'kernel-PAE-2.6.18-416.el5.i686', u'kernel-PAE-devel-2.6.18-416.el5.i686', u'kernel-xen-2.6.18-416.el5.i686', u'kernel-xen-2.6.18-416.el5.x86_64', u'kernel-xen-devel-2.6.18-416.el5.i686', u'kernel-xen-devel-2.6.18-416.el5.x86_64']


# To determine if 'el5' appears in every item
if all('el5' in item for item in ERRATA_PKG_LIST):
    rhel = "rhel 5"

# To generate the list of items which contain 'el5'
el5_list = [item for item in ERRATA_PKG_LIST if 'el5' in item]

# To generate the list of items which do NOT contain 'el5'
not_el5_list = [item for item in ERRATA_PKG_LIST if 'el5' not in item]

# To print a list:
print('\n'.join(el5_list))

所以我从url获取id并尝试从db中检索细节我知道我需要包含一些东西才能使这个工作但我真的无法找到它。

我得到的错误

  

PHP致命错误:调用未定义的函数get_post_meta()

0 个答案:

没有答案