Skip to content

Commit

Permalink
Merge pull request #88 from damares86/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
damares86 authored Dec 19, 2022
2 parents b03969f + 2df021f commit 3b9d5d3
Show file tree
Hide file tree
Showing 41 changed files with 365 additions and 461 deletions.
7 changes: 7 additions & 0 deletions admin/assets/css/bootstrap.min.css

Large diffs are not rendered by default.

File renamed without changes.
19 changes: 10 additions & 9 deletions admin/class/Colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ class Colors{

private $conn;
private $table_name = "color";

public $id;
public $color;
public $prx;

// constructor
public function __construct($db){
Expand All @@ -19,7 +20,7 @@ function create(){

// insert query
$query = "INSERT INTO
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
color = :color";

Expand All @@ -46,7 +47,7 @@ function create(){
function update(){
// insert query
$query = "UPDATE
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
color = :color
WHERE
Expand Down Expand Up @@ -82,7 +83,7 @@ function showAll(){
$query = "SELECT
id, color
FROM
" . $this->table_name . "
" .$this->prx. $this->table_name . "
ORDER BY
color";

Expand All @@ -98,7 +99,7 @@ function showAllList(){
$query = "SELECT
id, color
FROM
" . $this->table_name . "
" .$this->prx. $this->table_name . "
ORDER BY
color";

Expand All @@ -110,7 +111,7 @@ function showAllList(){

public function countAll(){

$query = "SELECT id FROM color";
$query = "SELECT id FROM ".$this->prx."color";

$stmt = $this->conn->prepare( $query );
$stmt->execute();
Expand All @@ -122,7 +123,7 @@ public function countAll(){

function showById(){
$query = "SELECT *
FROM " . $this->table_name . "
FROM " .$this->prx. $this->table_name . "
WHERE id = ?
LIMIT 0,1";

Expand All @@ -143,7 +144,7 @@ function colorExists(){

// query to check if email exists
$query = "SELECT id, color
FROM " . $this->table_name . "
FROM " .$this->prx. $this->table_name . "
WHERE color = ?
LIMIT 0,1";

Expand Down Expand Up @@ -183,7 +184,7 @@ function colorExists(){
// delete the role
function delete(){

$query = "DELETE FROM " . $this->table_name . " WHERE id = ?";
$query = "DELETE FROM " .$this->prx. $this->table_name . " WHERE id = ?";

$stmt = $this->conn->prepare($query);
$stmt->bindParam(1, $this->id);
Expand Down
11 changes: 6 additions & 5 deletions admin/class/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Contact{
public $id;
public $label;
public $email;
public $prx;

// constructor
public function __construct($db){
Expand All @@ -20,7 +21,7 @@ function create(){

// insert query
$query = "INSERT INTO
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
label = :label,
email = :email";
Expand Down Expand Up @@ -51,7 +52,7 @@ function update(){

// insert query
$query = "UPDATE
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
email = :email
WHERE
Expand Down Expand Up @@ -88,7 +89,7 @@ function showAll(){
$query = "SELECT
*
FROM
" . $this->table_name . "
" .$this->prx. $this->table_name . "
ORDER BY
id";

Expand All @@ -104,7 +105,7 @@ function showAllContacts(){
$query = "SELECT
*
FROM
" . $this->table_name . "
" .$this->prx. $this->table_name . "
WHERE NOT id=1
ORDER BY
id";
Expand All @@ -117,7 +118,7 @@ function showAllContacts(){

function delete(){

$query = "DELETE FROM " . $this->table_name . " WHERE id = :id";
$query = "DELETE FROM " .$this->prx. $this->table_name . " WHERE id = :id";

$stmt = $this->conn->prepare($query);
$stmt->bindParam(":id", $this->id);
Expand Down
32 changes: 9 additions & 23 deletions admin/class/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class File{
public $rolename;
public $file;
public $operation;
public $prx;

// constructor
public function __construct($db){
Expand Down Expand Up @@ -71,13 +72,13 @@ function uploadFile(){
$query="";
if($this->operation=="add"){
$query = "INSERT INTO
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
filename = :filename,
title = :title";
}else if($this->operation=="edit"){
$query = "UPDATE
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
filename = :filename,
title = :title
Expand Down Expand Up @@ -121,7 +122,7 @@ function showAll($from_record_num, $records_per_page,$where){
$query = "SELECT
*
FROM
" . $this->table_name . " ".$where."
" .$this->prx. $this->table_name . " ".$where."
ORDER BY
id
LIMIT
Expand All @@ -135,7 +136,7 @@ function showAll($from_record_num, $records_per_page,$where){

public function countAll(){

$query = "SELECT id FROM files";
$query = "SELECT id FROM " .$this->prx."files";

$stmt = $this->conn->prepare( $query );
$stmt->execute();
Expand All @@ -147,7 +148,7 @@ public function countAll(){

public function countFetch($where){

$query = "SELECT id FROM files".$where."";
$query = "SELECT id FROM " .$this->prx."files".$where."";

$stmt = $this->conn->prepare( $query );
$stmt->execute();
Expand Down Expand Up @@ -239,7 +240,7 @@ function showError($stmt){
function update(){
// insert query
$query = "UPDATE
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
title = :title
WHERE
Expand Down Expand Up @@ -268,7 +269,7 @@ function update(){
// delete the file
function delete(){

$query = "DELETE FROM " . $this->table_name . " WHERE id = ?";
$query = "DELETE FROM " .$this->prx. $this->table_name . " WHERE id = ?";

$stmt = $this->conn->prepare($query);
$stmt->bindParam(1, $this->id);
Expand All @@ -283,7 +284,7 @@ function delete(){

function showById(){
$query = "SELECT *
FROM " . $this->table_name . "
FROM " .$this->prx. $this->table_name . "
WHERE id = ?
LIMIT 0,1";

Expand All @@ -301,21 +302,6 @@ function showById(){

}

// function rolename_id(){
// //select all data
// $query = "SELECT
// id, rolename
// FROM
// " . $this->table_name . "
// WHERE
// rolename = :rolename";

// $stmt = $this->conn->prepare( $query );
// $stmt->execute();

// return $stmt;
// }



}
Expand Down
7 changes: 4 additions & 3 deletions admin/class/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Home{

public $id;
public $name_function;
public $prx;


// constructor
Expand All @@ -19,7 +20,7 @@ public function __construct($db){
function create(){
// insert query
$query = "INSERT INTO
" . $this->table_name . "
" .$this->prx. $this->table_name . "
SET
name_function = :name_function";

Expand Down Expand Up @@ -55,7 +56,7 @@ function showAll(){
$query = "SELECT
*
FROM
" . $this->table_name . "
" .$this->prx. $this->table_name . "
ORDER BY
id";

Expand All @@ -69,7 +70,7 @@ function showAll(){

function delete(){

$query = "DELETE FROM " . $this->table_name . " WHERE name_function = :name_function";
$query = "DELETE FROM " .$this->prx. $this->table_name . " WHERE name_function = :name_function";

$stmt = $this->conn->prepare($query);
$stmt->bindParam(':name_function', $this->name_function);
Expand Down
Loading

0 comments on commit 3b9d5d3

Please sign in to comment.