hi,
i have problem when using SimplePdo with method fetchField().
when the query return empty record, that method raise the error "Call to a member function getData() on null".
i think the better is have result checking before call getData(), like this :
public function fetchField(string $sql, array $params = [])
{
$result = $this->fetchRow($sql, $params);
if (!$result) return false; //this checking the result is not null and return false
$data = $result->getData();
return reset($data);
}
thank you.
hi,
i have problem when using SimplePdo with method fetchField().
when the query return empty record, that method raise the error "Call to a member function getData() on null".
i think the better is have result checking before call getData(), like this :
thank you.