Trying to display all records for a specific customer
Briefly

The provided PHP code is only fetching the first record of the customer name because it uses 'fetch' which retrieves a single row. To get all records, 'fetchAll' should be used.
In the existing code, after preparing and executing the statement, a check is made for results. However, since 'fetch' is used, only the first matching result is returned instead of all results.
Recommendations include replacing 'fetch' with 'fetchAll' to retrieve an array of all records related to the specified customer and then iterating over that array to display each order.
Additionally, ensure the SQL query is structured properly to select all necessary fields and the table includes matching records for the customer name to avoid empty results.
Read at www.sitepoint.com
[
|
]