dongmeijian1716 2018-04-25 16:25
浏览 41
已采纳

我有一个MySQL查询正在执行选择但它没有被执行。 MySQL代码是00000

I have a MySQL query that is doing a select but it is not being executed. The MySQL code is 00000. The code previously worked but now no matter what I change the query to it returns no data. The code is below. Any help on this would be GREATLY appreciated!

$lettersToPrintQuery = "SELECT DISTINCT
                                  Registration.RegNumber, 
                                  Registration.RunnerID
                              FROM 
                                  Registration
                                  LEFT JOIN People On People.RunnerID = Registration.RunnerID
                              WHERE
                                  Registration.CLUBID = :CLUBid
                                  AND
                                  Registration.CLUBDonationLetterNeeded = 1
                              ORDER BY
                                  People.LastName, People.FirstName, People.MI";
        if ($lettersToPrintQuery = $pdoLink->prepare($lettersToPrintSQL))
        {
             error_log("Log prepare");

            $runnersBindValues = "";
            $runnersBindValues[":clubid"] = 19;
            error_log("Bind Parameters: " . json_encode($runnersBindValues));
            if ($lettersToPrintQuery->execute($runnersBindValues))
            {
                error_log("Log execute");
                if ($lettersToPrintQuery->rowCount())
                {
                    error_log("Log row count");
                    $numDonations = $lettersToPrintQuery->rowCount();
                    $_SESSION['RUNNERSAdmin']['Reg']['Donations']['CLUBDonationLettersToPrint'] = array();
                    $_SESSION['RUNNERSAdmin']['Reg']['Donations']['CLUBDonationLettersMailingList'] = array();
                    while ($row = $lettersToPrintQuery->fetch(\PDO::FETCH_ASSOC))
                    {
                        error_log("donation reg numbers inside loop: " . $row["RegNumber"]);
                        error_log("donation runner ids inside loop: " . $row["RunnerID"]);
                        $_SESSION['RUNNERSAdmin']['Reg']['Donations']['CLUBDonationLettersToPrint'][] = $row["RegNumber"];
                        $_SESSION['RUNNERSAdmin']['Reg']['Donations']['CLUBDonationLettersMailingList'][] = $row["RunnerID"];

                    }
                }
            }
            else{
                error_log("Mysql error info: " . json_encode($pdoLink->errorInfo()));
            }
        }
        error_log("Donation reg numbers: " . $_SESSION['RUNNERSAdmin']['Reg']['Donations']['CLUBDonationLettersToPrint']);
        error_log("Donation runner id: " . $_SESSION['RUNNERSAdmin']['Reg']['Donations']['CLUBDonationLettersMailingList']);

error_log("Log execute") is not executing. So it is just not executing

  • 写回答

1条回答 默认 最新

  • duandao2083 2018-04-25 16:30
    关注
    $lettersToPrintQuery = "SELECT DISTINCT
    

    should be:

    $lettersToPrintSQL = "SELECT DISTINCT
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vivo手机锁屏密码忘记了需要手机里的资料在百度里搜可以用ADB命令希望帮帮我
  • ¥15 关于#网络#的问题:网络是从楼上引一根网线下来,接了2台傻瓜交换机,也更换了ip还是不行
  • ¥15 资源泄露软件闪退怎么解决?
  • ¥15 CCF-CSP 2023 第三题 解压缩(50%)
  • ¥30 comfyui openpose报错
  • ¥20 Wpf Datarid单元格闪烁效果的实现
  • ¥15 图像分割、图像边缘提取
  • ¥15 sqlserver执行存储过程报错
  • ¥100 nuxt、uniapp、ruoyi-vue 相关发布问题
  • ¥15 浮窗和全屏应用同时存在,全屏应用输入法无法弹出