Opened 15 months ago

Last modified 15 months ago

#20178 new enhancement

wpdb class : provide a disconnect / connect to db functions

Reported by: arena Owned by: arena
Priority: normal Milestone: Awaiting Review
Component: General Version: 3.4
Severity: normal Keywords: dev-feedback
Cc:

Description

some hosts automatically disconnect mysql after a short while.
I think it could be interesting to have in wpdb a disconnect and connect functions.

Change History (2)

  • Summary changed from enhancement : wpdb class : provide a disconnect / connect to db functions to wpdb class : provide a disconnect / connect to db functions

Related: #5932

Hi ocean90

the code i am currently using

class data_base
{
	function mysql_disconnect()
	{
		global $wpdb;
		mysql_close($wpdb->dbh);
	}

	function mysql_connect()
	{
		global $wpdb;
		$wpdb->__construct(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
	}
}

but still have some "mysql_real_escape_string(): nn is not a valid MySQL- Link resource" on some webhosts after disconnecting/connecting !

Note: See TracTickets for help on using tickets.