gpt4 book ai didi

php - codeigniter count_all_results 与连接表

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

我在从表中获取行数时遇到问题。

这是我使用 codeigniter 进行的 mysql 查询:

$this->db->where('rd', 1);
$this->db->where('id_user_first', $user_type);
$this->db->from("messaging");
$this->db->join('answers', "answers.id_message = messaging.id AND answers.id_user != '$user_type'");
$count_reponse = $this->db->count_all_results();

我收到此错误消息:

Parse error: syntax error, unexpected '' '' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in

最佳答案

您可以尝试此解决方案来解决您的问题:

Please changes query

$this->db->select('messaging.*, answers.*');
$this->db->from("messaging");
$this->db->join('answers', "answers.id_message = messaging.id");
$this->db->where('answers.id_user <>', $user_type);
$this->db->where('messaging.rd', 1);
$this->db->where('messaging.id_user_first', $user_type);
$count_reponse = $this->db->count_all_results();

关于php - codeigniter count_all_results 与连接表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46364449/

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