Slight update to allow the instantiation with no row or Id
parent
1aa79c306b
commit
6df1425897
|
@ -5,16 +5,19 @@ require_once( 'Server.php' );
|
||||||
class Monitor {
|
class Monitor {
|
||||||
public function __construct( $IdOrRow ) {
|
public function __construct( $IdOrRow ) {
|
||||||
$row = NULL;
|
$row = NULL;
|
||||||
if ( is_int( $IdOrRow ) ) {
|
if ( $IdOrRow ) {
|
||||||
$row = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $IdOrRow ) );
|
if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
|
||||||
} else if ( is_numeric( $IdOrRow ) ) {
|
$row = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $IdOrRow ) );
|
||||||
$row = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $IdOrRow ) );
|
if ( ! $row ) {
|
||||||
} else if ( is_array($IdOrRow) ) {
|
Error("Unable to load Server record for Id=" . $IdOrRow );
|
||||||
$row = $IdOrRow;
|
}
|
||||||
} else {
|
} elseif ( is_array( $IdOrRow ) ) {
|
||||||
Error("Unknown argument passed to Monitor Constructor ($IdOrRow)");
|
$row = $IdOrRow;
|
||||||
return;
|
} else {
|
||||||
}
|
Error("Unknown argument passed to Monitor Constructor ($IdOrRow)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} # end if isset($IdOrRow)
|
||||||
|
|
||||||
if ( $row ) {
|
if ( $row ) {
|
||||||
foreach ($row as $k => $v) {
|
foreach ($row as $k => $v) {
|
||||||
|
|
Loading…
Reference in New Issue