Skip to content

Instantly share code, notes, and snippets.

@JPDesign
Forked from einpraegsam/InsertExample.php
Created February 26, 2021 05:08
Show Gist options
  • Select an option

  • Save JPDesign/e3fcad0cf40fc30d2b9307c82ab2766a to your computer and use it in GitHub Desktop.

Select an option

Save JPDesign/e3fcad0cf40fc30d2b9307c82ab2766a to your computer and use it in GitHub Desktop.
TYPO3 QueryBuilder example use
<?php
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
$result = $queryBuilder
->select('*')
->from('tt_content')
->where('hidden = 0 and colPos = 0')
->orderBy('sorting')
->setMaxResults(3)
->execute();
$rows = $result->fetchAll();
var_dump($rows);
<?php
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
$result = $queryBuilder
->select('header')
->from('tt_content')
->where('colPos=0')
->execute();
while ($row = $result->fetch()) {
var_dump($row);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment