gpt4 book ai didi

php - 连接不同数据库上的表,同时绑定(bind)值

转载 作者:行者123 更新时间:2023-11-29 18:08:35 25 4
gpt4 key购买 nike

我正在尝试使用boundValues 中的信息更新表。除了 city_id。我需要使用boundValue中的城市从x

获取其关联的city_id
$stmt = $this->db->prepare(
"
UPDATE x_addresses
INNER JOIN x ON x = x...
SET
customer_id = :userId,
first_name = :firstname,
last_name = :lastname,
state = :state,
company_name = :company,
street1 = :street1,
street2 = :street2,
postal = :postalCode,
country = :country,
city = :city,
city_id = x,
region = :region,
WHERE customer_id = $id
"
);

最佳答案

您无法访问表列值,除非您尚未选择它。在这里您可以进行更新以确保该标签存在,但您无法选择值,您必须为此执行不同的数据库查询。

例如

select dbCore.locations_zones_cities.city_id from table where x
update x

关于php - 连接不同数据库上的表,同时绑定(bind)值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47602936/

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