xPDOQuery.isValidClause
Last updated not available | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn morexPDOQuery::isValidClause¶
Validates a string as an SQL clause. The check rejects strings containing a semicolon, the word UNION (case-insensitive), sleep(N) or benchmark(); everything else is accepted. This is why sortby('RAND()') works while an arbitrary string with a semicolon does not.
Syntax¶
boolean isValidClause (string $clause)
Example¶
if (xPDOQuery::isValidClause('RAND()')) {
$query->sortby('RAND()');
}
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










