duan205571 2015-06-15 22:46
浏览 32

Mysql错误'无效使用组函数'[重复]

This question already has an answer here:

I am trying to check which ID is less than 2 times in ID_REF field with the code below. Its a referral application where the ID can refer only 2 directs. Cheers

enter image description here

CODE

 $stmt = $conex->prepare("SELECT id FROM tb_modules WHERE count(id_ref) < ? ORDER BY id DESC LIMIT 1");



                        $stmt->bind_param("s", $n);
                        $n = 2;

                        $stmt->execute();

                        $stmt->store_result();
                        $numrows = $stmt->num_rows;


                         $stmt->bind_result($id);

                        //$stmt->fetch();

                        $stmt->close();

                        //echo $id.' '.'oi';
                        while ($stmt->fetch()) {
                        echo $id;
                        }


                    }
</div>
  • 写回答

3条回答 默认 最新

  • dtyqeoc70733 2015-06-15 23:57
    关注

    Do the following:

    var_dump($conex);
    $stmt = $conex->prepare("SELECT id FROM tb_modules WHERE count(id_ref) < ? ORDER BY id DESC LIMIT 1");
    
    var_dump($stmt)
    

    This should shed some light on the matter. I'm betting the $stmt variable is bool or null.

    评论

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备