Do you think its smarter to have a function to connect to a mysql db, and call that from your main file, or to have the code right on the main file. I'm hearing mixed answers. Thanks to any help!
I would suggest abstracting out all functions for working with databases in its own file/class. This way you won't be duplicating code across your site, and you can just carry the class over to another project whenever needed.
hmm, that was something i was told before but I never really thought about it. thanks for getting me on the right track!
well, if its not really a big application you can just create a function or file that you can use all through your app, that way, when a database change occurs, you wont be editing each and every file.
when you have more than one file accessing the databases, you can create a seperate file which you can just include to access the database. Otherwise you can put that in the same file as the main script..