PDO查询返回bool(false)

时间:2015-07-02 13:37:32

标签: php

在我bool(false)时,知道为什么这部分来源会返回var_dump($row)

$vote_rank = 0;
    $query = $pdo->prepare("SELECT SUM(vote_rank) as vote_rank FROM ipaddress_vote_map WHERE image_id = :image_id AND ip_address = :ip_address");
    $query -> bindParam(':image_id', $_GET['image_id'], PDO::PARAM_INT);
    $query -> bindParam(':ip_address', $ip_address, PDO::PARAM_INT); 
    $query->setFetchMode(PDO::FETCH_NUM);

    $row = $query->fetch(); 
    $up = "";
    $down = "";

    if(!empty($row[0]["vote_rank"])) {
           $vote_rank = $row[0]["vote_rank"];
           if($vote_rank == -1) {
               $up = "enabled";
               $down = "disabled";
           }
           if($vote_rank == 1) {
               $up = "disabled";
               $down = "enabled";
           }
     }           
     var_dump($row);

当我尝试回显结果时$row['vote_rank']即使不是value='0'

我也0

0 个答案:

没有答案