gpt4 book ai didi

mysql - SQL 查询中出现意外的 T_CONSTANT_ENCAPSED_STRING 错误

转载 作者:行者123 更新时间:2023-11-29 09:11:56 26 4
gpt4 key购买 nike

我在以下 SQL 查询中收到意外的 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;
}

最佳答案

将 SQL 语句括在引号中 - "

mysql_query ("UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_id' = '$id'");

关于mysql - SQL 查询中出现意外的 T_CONSTANT_ENCAPSED_STRING 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5333823/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com