prepare($stmt_string); foreach ($parameters as $k => $v) { $stmt->bindValue($k, $v); } return $stmt->execute(); } function sql_fetch_actor($conn, string $preferred_username) { $object_id = 'https://' . HOSTAS_DOMAIN . "/api/v1/actor/$preferred_username"; $result = prepare_and_execute($conn, "select * from actor join object on actor.objectId = object.id where object.id = :object_id", array(':object_id' => $object_id) ); // fetchArray returns false when there's no array; we're rather have it be // explicitly null $actor = $result->fetchArray(SQLITE3_ASSOC); return $actor !== false ? $actor : null; }