,我在下面的SQL查詢得到了意想不到的T_CONSTANT_ENCAPSED_STRING錯誤:意外T_CONSTANT_ENCAPSED_STRING錯誤
mysql_query (UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_id' = '$id');
你們可以看到那裏的錯誤可能是什麼?
下面是完整的代碼的情況下,它可以幫助:
$key = 'feed';
$post_ids = array(2263, 2249);
foreach ($post_ids as $id) {
$feedurl = get_post_custom_values($key, $id);
$feedurlstr = implode($feedurl);
// Ignore - it determines whether feed is live and returns $result
LiveOrNot($feedurlstr);
if ($result == "live") {
mysql_query (UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_id' = '$id');
}
elseif ($result == "notlive") {
mysql_query (UPDATE 'wp_posts' SET 'post_status' = 'draft' WHERE 'post_id' = '$id');
}
endif;
}
謝謝丹尼爾 - 那是對的。 – Alberto 2011-03-17 02:00:02