tags:

views:

137

answers:

2

Just started using mysqli. If I'm working with small data sets on small websites (traffic-wise), do I really need to use these all the time?

$result->close(); $mysqli->close();

also, for someone doing custom php & mysql work, without a framework, is mysqli the general preferred way of interacting with mysql?

+1  A: 

You should get in the habit of doing cleanup right (calling close as soon as you're done), or the resource leaks can gradually accumulate until they impact performance.

As far as what DB layer, learning PDO should be worthwhile because it is well-designed and compatible with all the major databases.

Matthew Flaschen
+1  A: 

PHP will close all open files and DB connections at the end of the script. It's good practice to do it manually when you are done with the connections, but it's no disaster if you don't. If you have a DB connection that will be used throughout the whole script you can as well leave it open.

+1 on PDO

Emil Vikström