my problem "is too many connection to MySQL" because i had created a new object for each function that had needed it.
What is the best solution for this operation? There is other methods?
$db = connection(); // PDO
//1
function test(){
$GLOBALS['db']->prepare(..);
}
// 2
function test2(){
global $db
$db->prepare(..);
}