$utils = new Utilities($utilDb); //$assetCnt = $utils->getCount(); //$catArray = $utils->getCategories(); // Get a list of categories //$statArray = $utils->getStatus(); // Get a list of status levels //$licArray = $utils->getLicense(); // Get a list of licenses (disabled 2016-07-27/Daniel) //$depArray = $utils->getDepartments(); // Get a list of departments //$supArray = $utils->getSuppliers(); // Get a list of suppliers } /** * Create an instance of DbHandler and fetch data to be used in the asset form */ try { $dbh = new DbHandler($DBNAME, $DBUSER, $DBPASSWD, $DBDRIVER, $DBSERVER); $assetCnt = $dbh->getCount(); $catArray = $dbh->categories(); $arClients = $dbh->clients(); $depArray = $dbh->departments(); $manufArray = $dbh->manufacturers(); $statArray = $dbh->status(); $supArray = $dbh->suppliers(); } catch (Exception $ex) { $template = $twig->loadTemplate('error.tmpl'); echo $template->render(array('pageTitle' => "OSCAR - ERROR", 'error' => $ex->getMessage())); die; // Not a very nice solution, but let's run with it for now } /** * Construct an array with some useful data in it */ $cfgData = array('dbServer' => $DBSERVER, 'dbName' => $DBNAME, 'dbType' => $DBTYPE, 'dbUser' => $DBUSER, 'assetCnt' => $assetCnt, 'priv' => $priv, 'userName' => $_SESSION['username']); try {
$asset->setAsset(56); $asset->setManufacturer("Gnumaker"); $asset->setModel("Supermodel"); echo "Read back the properties\n"; echo "Asset : " . $asset->getAsset() . "\n"; echo "Manufacturer: " . $asset->getManufacturer() . "\n"; echo "Model : " . $asset->getModel() . "\n"; echo "\nOK, now let us connect to the database.\n"; $dbname = "asset_v3"; $dbuser = "******"; $dbpasswd = "g4dba103"; $dbhost = "localhost"; $dbtype = "mysql"; echo "dbname={$dbname}\n"; echo "dbuser={$dbuser}\n"; echo "dbhost={$dbhost}\n"; echo "dbtype={$dbtype}\n"; // Create an instance of DbHandler $dbh = new DbHandler($dbname, $dbuser, $dbpasswd, $dbtype, $dbhost); echo "Getting the last asset. It seem to be: " . $dbh->getLatestAsset() . "\n"; echo "And list clients...\n"; $clients = $dbh->clients(); echo "\nUsing print_r()\n"; print_r($clients); echo "\n"; echo "Looping through the array 'manually'\n"; foreach ($clients as $id => $client) { echo "ID = " . $clients[$id]['id'] . " - client = " . $client; } $dbh = null; // Close the db handle