⇧
vadnica-logo
My Services About the Project Telegram O meni O meni

Reading Data (SELECT / FETCH)

To retrieve data in PDO, we use the query() method (for simple queries) or prepared statements. We then process the results using the fetchAll() method, which returns all rows at once in the form of an array.

EXAMPLE
RESULT
The result will be displayed here...

By using the PDO::FETCH_ASSOC mode, we ensure that the results are returned as an associative array, where the keys match the column names in the database (e.g., $row["name"]). In the example below, we will output all users from our table.