I have an MVC framework that works like this:
/models/Mo_Sql.php (contains the connectdb function)
/models/Mo_ClassName1.php (that extends Mo_Sql)
/models/Mo_ClassName2.php (that extends Mo_Sql)
/models/Mo_ClassName...X.php (that extends Mo_Sql)
/models/...
/rules/Ru_ClassName1.php (with private Mo_ClassName1)
/rules/Ru_ClassName2.php (with private Mo_ClassName2)
/rules/Ru_ClassName...X.php (with private Mo_ClassNameX)
/rules/Ru_......
/config/config.php with all Mo_ and Ru_ included and is called in every page of my site.
The concern that I have is that when i require_once config.php, this latter includes N Mo_ files and N Ru_ files, therefore upon construction, I believe there will be multiple db connections opened as every Mo_ file extend Mo_Sql.
My question : is it dangerous to proceed like this? Is there another way to call only once Mo_SQL and/or Mo_Sql->connectdb?
Thanks for your help