Skip to content

Conversation

@pathak404
Copy link

Error explanation:

The line implode("AND", array_map(fn($attr) => "$attr = :$attr", $attributes));
will produce an error "Invalid parameter number: parameter was not defined"
because if the item in the array $attributes is greater than 1 then it will separate them by AND but there is no gap between them.

eg: attr1 = :attr1ANDattr2 = :attr2

so it will produce an error.

Fix:

By adding a single space character before and after the separator AND
implode(" AND ", array_map(fn($attr) => "$attr = :$attr", $attributes));
will produce:

attr1 = :attr1 AND attr2 = :attr2

this is the right syntax... 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant