DbConnect();
}
protected function DbConnect()
{
include "/home/srv/html/bms/includes/db_config.php";
$this->conn = mysql_connect($servername,$username,$password) OR die("Unable to connect to the database");
mysql_select_db($db,$this->conn) OR die("can not select the database $db");
return TRUE;
}
public function ShowDCs()
{
$sql = "SELECT * FROM datacenters ORDER BY dc_name";
$res = mysql_query($sql,$this->conn);
$datacenter = '';
while($row = mysql_fetch_array($res))
{
$datacenter .= '';
}
return $datacenter;
}
public function ShowUnitType()
{
$sql = "SELECT * FROM unittypes ORDER BY utype_name";
$res = mysql_query($sql,$this->conn);
$unittype = '';
while($row = mysql_fetch_array($res))
{
$unittype .= '';
}
return $unittype;
}
public function ShowUnits()
{
$sql = "SELECT * FROM units WHERE utype_id=$_POST[utype_id] AND dc_id=$_POST[dc_id] ORDER BY unit_name";
$res = mysql_query($sql,$this->conn);
$unit = '';
while($row = mysql_fetch_array($res))
{
$unit .= '';
}
return $unit;
}
public function ShowAlerts()
{
$sql = "SELECT * FROM alerts WHERE utype_id=$_POST[utype_id] ORDER BY alert_name";
$res = mysql_query($sql,$this->conn);
$alert = '';
while($row = mysql_fetch_array($res))
{
$alert .= '';
}
return $alert;
}
}
$opt = new SelectList();
?>