Part II: Developing Intranet Solutions // Insert the (Web hosting domain names)

Part II: Developing Intranet Solutions // Insert the path in the PHP include_path so that PHP // looks for our PEAR, PHPLIB and application framework // classes in these directories ini_set( include_path , : . $PATH . : . ini_get( include_path )); // Now load the DB.php class from PEAR require_once DB.php ; // Now load our DBI class from application framework require_once( class.DBI.php ); // Setup the database URL $DB_URL = mysql://root:foobar@localhost/foobar ; // Create a DBI object that connects to the // database URL $dbi = new DBI($DB_URL); if (! $dbi->isConnected()) { echo Connection failed for $DB_URL
; exit; } $id = 100; $name = Joe Gunchy ; $name = $dbi->quote($name); $statement = INSERT INTO PROD_TBL (ID,NAME) . VALUES($id, $name) ; $result = $dbi->query($statement); if ($result == NULL) { echo Database error: . $dbi->getError() .
n ; } else { echo Added $name in database.
n ; } ?>

Leave a Reply