07-02-2008, 10:53 PM
|
#7 (permalink)
|
|
Moderator
Join Date: Sep 2007
Location: Near you.
Posts: 452
Thanks: 228
|
PHP Code:
<?php error_reporting(E_ALL & ~E_NOTICE); class db_connect { private $dbn; private $user; private $pass; private $db_selected; public function db_connect() { $this->specs('localhost', 'orb', '123123'); $this->showConnectionDetails(); } public function specs($dbn, $user, $pass, $db_selected) { $this->db_selected = $db_selected; $this->dbn = $dbn; $this->user = $user; $this->pass = $pass; $dbtestcon = mysql_connect($dbn, $user, $pass); if (!$dbtestcon) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; } // Now this function will work function showConnectionDetails() { $db_selected = mysql_select_db('zone', $dbtestcon); if (!$db_selected) die ('Can\'t use workspace : ' . mysql_error());
} }
?>
what am i doing wrong with this snippet of code??..
__________________
inquisitive
1. Eager to acquire knowledge.
2. Too curious; overly interested; nosy.
Last edited by codefreek : 07-03-2008 at 07:30 AM.
|
|
|
|