我正在运行以下查询:
$query = "SELECT post_title, ID, post_date_gmt, post_author
FROM wp_posts
WHERE post_type='course-manager'
AND post_status='publish'
AND SUBSTRING(post_date_gmt,1,4) = '$this->yearGet'
AND SUBSTRING(post_date_gmt,6,2) = '$this->monthGet'
AND post_author = '$userid'
ORDER BY post_title";
$query_result = mysql_query ($query);
while ($info = mysql_fetch_array($query_result))
{
目前这只是查询 wordpress 帖子表。我还想从 wordpress postmeta 表中查询数据,一个例子是这样的,我在 postmeta 表中添加了“AND course_date:
$query = "SELECT post_title, ID, post_date_gmt, post_author
FROM wp_posts
WHERE post_type='course-manager'
AND post_status='publish'
AND SUBSTRING(post_date_gmt,1,4) = '$this->yearGet'
AND SUBSTRING(post_date_gmt,6,2) = '$this->monthGet'
AND post_author = '$userid'
AND course_date = '$this->yearGet'
ORDER BY post_title";
$query_result = mysql_query ($query);
while ($info = mysql_fetch_array($query_result))
{
任何帮助将不胜感激