php pdo,过滤结果无法使用NOT IN

时间:2013-12-22 13:01:56

标签: php mysql pdo

我有两个mysql表: 持有日期/时间/描述的人。 第二个还包含用户可以选择的时间。只是一个简单的列表,8:30,9:00等等。

现在我想要按时间检查时间是否合适,它只显示表格时间,但除了已经使用的议程时间外。

到目前为止我的代码:

 public function checkTime($date){  
        // loop trough agenda, by date which i get from the function parameter
        $fetch = $this->dbprocess()->prepare("SELECT * FROM agenda WHERE datum = :date");
        $fetch->bindParam(':date', $date);
        $fetch->execute(); // execute this one
        // this is the query which gets the whole time data, get here data from $fetch and then display ONLY the data which isn't in use yet by agenda
        $result = $this->dbprocess()->prepare("SELECT * FROM uren WHERE NOT uur IN (?)");


        $result->execute(array("8:30,12:00")); // testing, this should be the data of agenda, so it gets the time which is in use by date from the first query

// display the time, with the time in agenda filtered(In this case only 8:30 , 12:00 should be filtered).
        while($row = $result->fetch(PDO::FETCH_ASSOC)){
            echo $row['uur'];
        }
    }

但它没有显示任何东西.. 它运行的东西卡在NOT和IN中,但idk如何...... 如果我作为bindparams使用它,并使用Where .... AND ....,但这应该工作以及...

我希望你理解我的问题,我真的卡住了。

0 个答案:

没有答案