Hello, I want to build a class that handles the database connection and the queries. When I have a select query( select name, surname from users where 1 ) for example, I bind the results to let's say $bind1 and $bind2 and while the statement fetches I print the result. My question is how should I return the results outside the class, because there could be more than two binded variables. Probaby the design I'm thinking of isn't very good and should be started from zero.
I'd start with a review of other database connection libraries. Don't copy what they do but try to understand why they make the decisions they make and understand how that both limits them and enhances them. Once you have done that 3 or 4 times you'll have a better idea of how yours should look. As an example... many cater for database queries that I'll never need to use, so if I were to write a library I can simplify things and reduce the bloat.
Could you give me one or two links ? I have been studying two libraries but they didn't use parameterized queries and had some vulnerabilities
If you can't find any good libraries start with joomla, wordpress and any of the frameworks. They have database libraries built in. In wordpress look for /includes/wp-db.php