I gone through one of my old project. Some of the points I noticed to enhance and simplify the code.
-Combine methods into single method to achieve the same fuctionality.
As we are using the PEAR DB package to query to database. I thought to have a map of all the queries into any Array .
Steps I will follow to achieve the same is
-Create Map of queries
$queryMap = array (“getPerson”=>”SELECT * FROM person WHERE personID = “, “getPersonList”=>”SELECT * FROM person”)
-One method which will just run query and returns its output
function getData($query, $ID=0)
$result = $db->query(queryMap[$query].” “.$ID);
return $result = $db->getAll(queryMap[$query]);
I will be implementing it in my new project.