在where子句中传递查询数据(数组)时进行字符串转换的数组。我试过了,所以现在我要害怕了。我试图在->result()
中将->row()
替换为$ord = "query"
但是没有。我请任何身体帮助我,我现在该怎么办。谢谢。这是我的代码。
public function order_join()
{
$ord = $this->db->query('SELECT `Order_ID` FROM `order` WHERE `DateTime` = (SELECT MAX(DateTime) FROM `order`)')->result();
$query = "SELECT a.Order_ID, a.User_ID,a.Pro_ID, a.Price as Total_Amount, SUM(b.Amount)
as Total_Amount_Recieved, (a.Price - SUM(b.Amount)) AS Remaining_Amount
FROM `order` a JOIN `payments` b ON a.Order_ID = b.Order_ID WHERE a.Order_ID = '".$ord."' ";
return $this->db->query($query)->row();