Db\Adapter::fetchOne

public fetchOne (mixed $sqlQuery, [mixed $fetchMode], [mixed $bindParams], [mixed $bindTypes])

Returns the first row in a SQL query result

//Getting first robot
$robot = $connection->fetchOne("SELECT * FROM robots");
print_r($robot);

//Getting first robot with associative indexes only
$robot = $connection->fetchOne("SELECT * FROM robots", Phalcon\Db::FETCH_ASSOC);
print_r($robot);
doc_Phalcon
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.