有没有可能有这个功能:
function getProjectData($uid, $what) {
$sql = "SELECT ? FROM projects WHERE fid = ?";
$stmt = $this->db->prepare($sql);
$stmt->execute(array($uid,$what);
return $stmt->fetch(PDO::FETCH_LAZY);
}
“uid”是用户 ID,“what”是我想要的列,例如“title”,所以查询是:
SELECT title FROM projects WHERE fid = 1
这可能吗?