View Full Version : How did vbulletin close the database
hurricane_sh
03-11-2012, 09:10 AM
I can't see any db close statement in php files like showthread.php. I wrote my own php file which uses the $db object, does it look right? Thanks!
require_once('./global.php');
$result = $db->query_first("select .....");
.....
$db->free_result($result);
$db->close();
nhawk
03-11-2012, 11:27 AM
Closing the database with the close like you have it isn't needed unless it's a persistent connection. A regular database connection is automatically closed at the end of execution of the script.
hurricane_sh
03-11-2012, 11:54 AM
Many thanks for your reply!
$db->close() is called in most vb scripts - it's in function exec_shut_down() which is called from print_output(), which is the last function called in most scripts. (You can see it in the eval() at the end of showthread.php).
hurricane_sh
03-11-2012, 02:53 PM
Thanks for the detailed explanation, Kevin!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.