我有一个没有输出的简单类:
class ICRR extends Profile {
public $recommendation_text;
public $comments;
public $men_id;
public $recommendation;
public $uid;
public function __construct($uid)
{
include 'con.php';
$stmt = $conn->prepare(
'SELECT * FROM icrr WHERE uid = :uid');
$stmt->execute(array(':uid' => $uid));
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
$this->men_id = $row['men_id'];
$this->uid = $row['uid'];
$this->nid = $row['nid'];
$this->recommendation = $row['reccomendation'];
$this->comments = $row['comments'];
$this->date_submitted = $row['date_submitted'];
}
}
public function recommendation_text() {
switch ($this->recommendation){
case 1 :
$this->recommendation = 'Yes Certify';
break;
case 2 :
$this->recommendation = 'No Do Not Certify';
break;
case 3 :
$this->recommendation = 'Certify Pending Requirements';
break;
default : echo "Recommendation Not Received";
}
return $this->recommendation_text;
}
}
当我问:
$ICRR = new ICRR($uid);
var_export($ICRR);
一切都是空的。我检查了查询,它正在返回数据...我之前使用过这样的类,它工作正常所以我想我错过了一些我无法看到的东西..