/** * Prepare this FQL * * @return FDOStatement */ function prepare() { $query = "SELECT " . implode(",", $this->select) . " " . "FROM " . $this->from . " " . "WHERE " . implode(" AND ", $this->where) . " "; if ($this->orderBy) { $query .= "ORDER BY " . $this->orderBy . " "; } if ($this->limit) { $query .= "LIMIT " . $this->limit . " "; } $stmt = $this->fdo->prepare($query); if (!empty($this->params)) { foreach ($this->params as $parameter => $value) { $stmt->bindValue($parameter, $value, $this->types[$parameter]); } } $this->logger->debug("FQL: " . $stmt->getQueryString()); return $stmt; }
<?php ini_set("display_errors", 1); error_reporting(E_ALL); include_once "../vendor/autoload.php"; use fdo\FDO; $fdo = new FDO(); $fql = "SELECT uid, name, sex FROM user WHERE uid = :uid"; $stmt = $fdo->prepare($fql); $stmt->bindValue(":uid", 4, FDO::PARAM_INT); $stmt->execute(); $result = $stmt->fetch(FDO::FETCH_OBJ); var_dump($result);