-
-
Save JPDesign/e3fcad0cf40fc30d2b9307c82ab2766a to your computer and use it in GitHub Desktop.
TYPO3 QueryBuilder example use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| My Text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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