PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
There're over hundred of settings stored in database, and I dont want this function to be few pages long. Would there be a shorter, and more logical way to write this function?
I'd go one of two routes. Either change the SQL in the function to only fetch the config variable with the requested name (eg "select * from config where name = '$v'") .. or if the variables are used on every page I'd put the all into an array at the beginning of each script and then just echo $config['title'] or $config['version'] etc where necessary. It depends on the rest of your code really.
It might be better to load all of the config settings into a single array at the beginning of the page instead of calling a query every time you need to load a single config setting.