add default parameter in constuctor

This commit is contained in:
Isaac Connor 2015-12-15 13:27:57 -05:00
parent 6bb22a9a1b
commit 8f141305b7
1 changed files with 2 additions and 2 deletions

View File

@ -1,9 +1,9 @@
<?php <?php
require_once( 'database.php' ); require_once( 'database.php' );
class Storage { class Storage {
public function __construct( $IdOrRow ) { public function __construct( $IdOrRow = NULL ) {
$row = NULL; $row = NULL;
if ( isset($IdOrRow) ) { if ( $IdOrRow ) {
if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) { if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
$row = dbFetchOne( 'SELECT * FROM Storage WHERE Id=?', NULL, array( $IdOrRow ) ); $row = dbFetchOne( 'SELECT * FROM Storage WHERE Id=?', NULL, array( $IdOrRow ) );
if ( ! $row ) { if ( ! $row ) {