Skip to content

Commit

Permalink
Merge pull request #13 from tanhongit/4-clean_code
Browse files Browse the repository at this point in the history
move the position of the query function
  • Loading branch information
tanhongit authored Jan 3, 2023
2 parents b7dc9c4 + 8720208 commit c6e7bfd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Controller
*/
public function index()
{
self::renderView('frontend.index');
$this->renderView('frontend.index');
}

/**
Expand Down
9 changes: 9 additions & 0 deletions app/core/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ public function connect()
return $this->connection;
}

/**
* @param $sql
* @return bool|mysqli_result
*/
public function _query($sql)
{
return mysqli_query($this->connectResult, $sql);
}

/**
* Execute the query and process the returned results
* @param $sql
Expand Down
9 changes: 0 additions & 9 deletions app/models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ public function find($table, $id)
return $this->getRecordByID($table, $id);
}

/**
* @param $sql
* @return bool|mysqli_result
*/
public function _query($sql)
{
return mysqli_query($this->connectResult, $sql);
}

/**
* Escape special characters in string
* @param $str
Expand Down

0 comments on commit c6e7bfd

Please sign in to comment.