dongmeijian1716 2018-04-25 08: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 08:30
    关注
    $lettersToPrintQuery = "SELECT DISTINCT
    

    should be:

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

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部