PHP & MySQL Database Class
by webmasterjunkie on Nov.03, 2010, under MySQL, PHP, Programming
You would of course have to extend it to match your needs, but it’s a great start to solve those redundant coding problems.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | include_once("db.inc.php"); class db { public function db_connect () { global $config; if ($this->con == false) { $db = @mysql_connect ($config["dbhost"], $config["dbuser"], $config["dbpass"]); if ($db) { $dbe = @mysql_select_db ($config["dbname"], $db); if ($dbe) { $this->con = true; return true; } else { return false; } } else { return false; } } else { return false; } } } // More in the ZIP file attached to this thread. |
Link to this post!

Connect
Enter your WordPress.com blog URL
http://.wordpress.com
Proceed