There are couple of mySQL functions in PHP to find out the column fields, but it requires extra queries to be called. I just wanted to avoid that and in order to do so, you have to work with SQL query that you are going to run (just like everyone tries to combine 2 or 3 different select queries into 1 select query).
I'm making a pagenation class to be used for any of the tables in MySQL database. I just wanted to feed a table name and the rest would be taken care of by the class, but in order to do so, the class has to find out all the information it needs such as column names and how many of them are there in the table.
Class should be designed so that it can be used for any different projects. That's the whole reason for using OOP technique - re-usability. I'm simply trying to follow that rule 🙂