gpt4 book ai didi

php - 将数据库迁移到新服务器时,MySQL 错误字段列表中的未知列(Windows)

转载 作者:行者123 更新时间:2023-11-30 21:59:38 25 4
gpt4 key购买 nike

我将我的数据库从一台服务器转移到另一台服务器,在 Debug模式下,我在 Mysql 数据库中遇到了这个错误。

WordPress database error: [Unknown column 'tb.adult_price' in 'field list']

我想这就是它的开始

         $query="SELECT
post_id,
{$wpdb->prefix}st_tours.max_people,
{$wpdb->prefix}st_order_item_meta.adult_number+{$wpdb->prefix}st_order_item_meta.child_number+{$wpdb->prefix}st_order_item_meta.infant_number as total_booked
FROM
{$wpdb->prefix}st_tours
JOIN {$wpdb->prefix}st_order_item_meta ON {$wpdb->prefix}st_tours.post_id = {$wpdb->prefix}st_order_item_meta.st_booking_id
AND {$wpdb->prefix}st_order_item_meta.st_booking_post_type = 'st_tours'
WHERE
1 = 1
AND

SELECT SQL_CALC_FOUND_ROWS 0Ol3D_posts.*,CASE WHEN tb.adult_price > 0 and
tb.adult_price != '' THEN CASE WHEN tb.is_sale_schedule = 'on' AND
tb.discount != 0 AND tb.discount != '' AND tb.sale_price_from <= CURDATE()
AND tb.sale_price_to >= CURDATE() THEN CAST(tb.adult_price AS DECIMAL) - (
CAST(tb.adult_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL) WHEN
tb.is_sale_schedule != 'on' AND tb.discount != 0 AND tb.discount != '' THEN
CAST(tb.adult_price AS DECIMAL) - ( CAST(tb.adult_price AS DECIMAL) / 100 )
* CAST(tb.discount AS DECIMAL) ELSE tb.adult_price END WHEN tb.child_price >
0 and tb.child_price != '' THEN CASE WHEN tb.is_sale_schedule = 'on' AND
tb.discount != 0 AND tb.discount != '' AND tb.sale_price_from <= CURDATE()
AND tb.sale_price_to >= CURDATE() THEN CAST(tb.child_price AS DECIMAL) - (
CAST(tb.child_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL) WHEN
tb.is_sale_schedule != 'on' AND tb.discount != 0 AND tb.discount != '' THEN
CAST(tb.child_price AS DECIMAL) - ( CAST(tb.child_price AS DECIMAL) / 100 )
* CAST(tb.discount AS DECIMAL) ELSE tb.child_price END WHEN tb.infant_price
> 0 and tb.infant_price != '' THEN CASE WHEN tb.is_sale_schedule = 'on' AND
tb.discount != 0 AND tb.discount != '' AND tb.sale_price_from <= CURDATE()
AND
tb.sale_price_to >= CURDATE() THEN CAST(tb.infant_price AS DECIMAL) - (
CAST(tb.infant_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL) WHEN
tb.is_sale_schedule != 'on' AND tb.discount != 0 AND tb.discount != '' THEN
CAST(tb.infant_price AS DECIMAL) - ( CAST(tb.infant_price AS DECIMAL) / 100
) * CAST(tb.discount AS DECIMAL) ELSE tb.infant_price END ELSE 0 END AS
st_tour_price FROM 0Ol3D_posts LEFT JOIN 0Ol3D_term_relationships ON
(0Ol3D_posts.ID = 0Ol3D_term_relationships.object_id) WHERE 1=1 AND ( (
0Ol3D_term_relationships.term_taxonomy_id IN (470) ) ) AND
0Ol3D_posts.post_type = 'st_tours' AND (0Ol3D_posts.post_status = 'publish'
OR 0Ol3D_posts.post_status = 'private') GROUP BY 0Ol3D_posts.ID ORDER BY
RAND() LIMIT 0, 4

我搜索我的 php 文件并找到了代码:

    $query .=",CASE
WHEN tb.adult_price > 0 and tb.adult_price != ''
THEN
CASE
WHEN tb.is_sale_schedule = 'on'
AND tb.discount != 0 AND tb.discount != ''
AND tb.sale_price_from <= CURDATE() AND tb.sale_price_to >= CURDATE()
THEN
CAST(tb.adult_price AS DECIMAL) - ( CAST(tb.adult_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL)
WHEN tb.is_sale_schedule != 'on' AND tb.discount != 0 AND tb.discount != ''
THEN
CAST(tb.adult_price AS DECIMAL) - ( CAST(tb.adult_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL)

ELSE tb.adult_price
END

WHEN tb.child_price > 0 and tb.child_price != ''
THEN CASE
WHEN tb.is_sale_schedule = 'on'
AND tb.discount != 0 AND tb.discount != ''
AND tb.sale_price_from <= CURDATE() AND tb.sale_price_to >= CURDATE()
THEN
CAST(tb.child_price AS DECIMAL) - ( CAST(tb.child_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL)

WHEN tb.is_sale_schedule != 'on' AND tb.discount != 0 AND tb.discount != ''
THEN
CAST(tb.child_price AS DECIMAL) - ( CAST(tb.child_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL)
ELSE tb.child_price
END
WHEN tb.infant_price > 0 and tb.infant_price != ''
THEN CASE
WHEN tb.is_sale_schedule = 'on'
AND tb.discount != 0 AND tb.discount != ''
AND tb.sale_price_from <= CURDATE() AND tb.sale_price_to >= CURDATE()
THEN
CAST(tb.infant_price AS DECIMAL) - ( CAST(tb.infant_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL)

WHEN tb.is_sale_schedule != 'on' AND tb.discount != 0 AND tb.discount != ''
THEN
CAST(tb.infant_price AS DECIMAL) - ( CAST(tb.infant_price AS DECIMAL) / 100 ) * CAST(tb.discount AS DECIMAL)
ELSE tb.infant_price
END

ELSE 0
END AS st_tour_price";

我不太了解 SQL 和数据库..

有什么办法可以解决吗?

最佳答案

这是关于您在 Windows 中的设置...某些设置不正确(SQL-PHP 版本 - IIS 或 Apache)...尝试更改 config.php

 define('WP_DEBUG', false); --> define('WP_DEBUG', true);

就像您在 Windows 中所做的那样,查看您的 SQL 错误是否也存在。

如果不尝试正确移动数据库,这意味着不要立即全部导入,而是使用 sql 命令 - 使用文本编辑器打开导出文件并复制粘贴 - 以确保数据库安装正确.. 之后检查设置以及你的删除错误。

这发生在我身上,是我的服务器设置错误。

关于php - 将数据库迁移到新服务器时,MySQL 错误字段列表中的未知列(Windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43805801/

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