diff options
Diffstat (limited to 'models')
| -rw-r--r-- | models/database.php | 4 | ||||
| -rw-r--r-- | models/webpage.php | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/models/database.php b/models/database.php index 45be65b..62f5b10 100644 --- a/models/database.php +++ b/models/database.php @@ -39,9 +39,9 @@ abstract class Table { $conn = null; } - static protected function _get_all(string $table, string $class, string $additional = null) : array { + static protected function _get_all(string $table, string $class, string $additional = null, $columns = "*") : array { $conn = Table::connect(); - $query = $conn->query("SELECT * FROM $table " . $additional); + $query = $conn->query("SELECT $columns FROM $table " . $additional); $conn = null; $query->setFetchMode(PDO::FETCH_CLASS, $class); diff --git a/models/webpage.php b/models/webpage.php index 9dcc5ae..a7fa1b9 100644 --- a/models/webpage.php +++ b/models/webpage.php @@ -29,7 +29,8 @@ class Webpage extends Table { return Table::_get_all( 'Webpages', 'Database\Webpage', - "GROUP BY URL ORDER BY Visits DESC, Date DESC LIMIT $count" + "GROUP BY URL ORDER BY Visits DESC, Date DESC LIMIT $count", + 'WID,Path,URL,Date,MAX(Visits) as Visits,RequesterUID' ); } |
