DatabaseQuery::execute() method

Execute the query with the current database handle

Usage

// basic usage
$pDOStatement = $databaseQuery->execute();

// usage with all arguments
$pDOStatement = $databaseQuery->execute(array $options = []);

Arguments

NameType(s)Description
options (optional)array
  • throw (bool): Throw exceptions? (default=true)
  • maxTries (int): Max times to retry if connection lost during query. (default=3)
  • returnQuery (bool): Return PDOStatement query? If false, returns bool result of execute. (default=true)

Return value

PDOStatement bool

Exceptions

Method can throw exceptions on error:

  • WireDatabaseQueryException or \PDOException


DatabaseQuery methods and properties

API reference based on ProcessWire core version 3.0.248

Latest news

  • ProcessWire Weekly #582
    The 582nd issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
    Weekly.pw / 5 July 2025
  • New ProcessWire admin redesign
    When you upgrade to ProcessWire 3.0.248 or newer (currently the dev branch), you’ll immediately notice something new and beautiful…
    Blog / 9 May 2025
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull