Save the cloud after the creation
This commit is contained in:
parent
fea36cb867
commit
3fbeb06948
1 changed files with 20 additions and 3 deletions
21
db.php
21
db.php
|
@ -215,6 +215,13 @@ class DataBase
|
|||
} catch (PDOEXception $e) {
|
||||
return false;
|
||||
}
|
||||
$this->cloud = array(
|
||||
'id' => $this->db->lastInsertId(),
|
||||
'code' => $ref,
|
||||
'size' => $size,
|
||||
'delete_t' => $duration,
|
||||
'text' => $text,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
public function loadCloud($ref)
|
||||
|
@ -225,6 +232,11 @@ class DataBase
|
|||
return $this->loadCloudByCode($ref);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load the cloud by its id
|
||||
* @param int $id code of the cloud
|
||||
* @return boolean True if the loading is done, False otherwise
|
||||
*/
|
||||
public function loadCloudById(int $id)
|
||||
{
|
||||
$stmt = $this->db->prepare("
|
||||
|
@ -240,13 +252,18 @@ class DataBase
|
|||
'code' => $data['code'],
|
||||
'size' => $data['size'],
|
||||
'delete_t' => $data['delete_t'],
|
||||
'text' => $data['test'],
|
||||
'text' => $data['text'],
|
||||
);
|
||||
return true;
|
||||
}
|
||||
$this->cloud = null;
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Load the cloud by its code
|
||||
* @param string $code code of the cloud
|
||||
* @return boolean True if the loading is done, False otherwise
|
||||
*/
|
||||
public function loadCloudByCode(string $code)
|
||||
{
|
||||
$stmt = $this->db->prepare("
|
||||
|
@ -262,7 +279,7 @@ class DataBase
|
|||
'code' => $data['code'],
|
||||
'size' => $data['size'],
|
||||
'delete_t' => $data['delete_t'],
|
||||
'text' => $data['test'],
|
||||
'text' => $data['text'],
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue