mysqli查询始终返回空

时间:2014-06-17 20:08:40

标签: php mysql mysqli

我正在运行一个来自php的MySQL实例的查询,它在一个不同的文件中工作之前和之后我复制它似乎总是返回空。

function getDelivery($eid, $raid){
    ChromePhp::log("eid:".$eid." raid:".$raid);
    $mysqli = getMysqliConnection();
    $q = "SELECT COMMENTS, DELIVERY_TIME FROM DELIVERY WHERE RAID = ? AND EID  = ?;";
    $stmt = $mysqli->prepare($q);
    $stmt->bind_param('ss'. $raid, $eid);
    $stmt->bind_result($comments, $time);
    $stmt->execute();
if($stmt->fetch()){
    ChromePhp::log("TIME: ". $time);
    $data = array("comments" => $comments, "time" => $time ,"raid" =>$raid, "eid"=>$eid);
    echo json_encode($data);
}else{
    echo "{}";
}

$stmt->close();
$mysqli->close();
}

我使用chrome控制台确保eid和raid不为NULL,当我将查询复制到phpAdmin返回1结果时。但是fetch()似乎总是返回false,它是否有任何错误,它总是返回什么?

0 个答案:

没有答案