addError (method)

Last updated: Thu, Jan 12, 2023 4:05 pm
Return to Knowledgebase

Purpose

Adds an error message when an item fails validation

Location

users/classes/Validate.php

Version Information

First Introduced v3.0.0

Parameters

# Parameter Data Type Required Description
1 $error string Yes Pass an error message in this string.

Returns

Data Type Description of Returned Data
nothing

Example

$validation->addError("Your username is incorrect");

Further Documentation:

When using the Validation class you can add a new error message to the errors array every time a validation fails.

$validate = new Validate();
$validate->addError("Testing123");
dump($validate->errors());