from("order_info oi-6ren">
gpt4 book ai didi

php - 如何将这个php查询翻译成mysql?

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

尝试使用此查询来使用 mysql 获取数据

$this->db->select("ii.id,oi.user_id as uid,oi.id as oid")->from("order_info oi")->join("iform_info ii","oi.id = ii.order_id")->where("oi.order_no",$id)->get()->row_array();

我在想这样的事情

SELECT * FROM `order_info` JOIN(iform_info) WHERE `order_id` = '1'

最佳答案

试试这个:

$this->db->select("ii.id,oi.user_id as uid,oi.id as oid")->from("order_info oi")->join("iform_info ii","oi.id = ii.order_id")->where("oi.order_no",$id)->get()->row_array();

转换为

SELECT ii.id, oi.user_id as uid, oi.id as oid
FROM order_info oi JOIN iform_info ii ON oi.id = ii.order_id
WHERE oi.order_no = $id

您可以在 PHP 代码中使用此 SELECT 查询并动态传递 $id

关于php - 如何将这个php查询翻译成mysql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55203910/

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