0

Trying to use this query to get the data using the 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();

I was thinking something like this

SELECT * FROM `order_info` JOIN(iform_info) WHERE `order_id` = '1'
2
  • Please post the result of your MySQL query and tell us what you are trying to achieve Commented Mar 17, 2019 at 5:21
  • I was just trying to use the same query the php is using to get the same result using navicat or mysql Commented Mar 17, 2019 at 5:51

1 Answer 1

1

Try this:

$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();

converts to

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

You can use this SELECT query in your PHP code and pass $id dynamically.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.