lollipop

A PHP-framework
Log | Files | Refs

commit 02d87526c847e371bd65e5bc03bf0fe9cb69d7c0
parent 9570964b7bc52636e4e2376ec7994af0b50fd46c
Author: Gerco van Woudenbergh <[email protected]>
Date:   Sat, 15 Apr 2023 13:22:54 +0200

more documentation

Diffstat:
MLollipop/SQLDatabase.php | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/Lollipop/SQLDatabase.php b/Lollipop/SQLDatabase.php @@ -14,6 +14,9 @@ namespace Lollipop { function get(string $table_class, $name) { + /* this function accepts a $table_name and a value, $name for the primary get of the table + * retuns a Database object + */ $cls = new $table_class($this); $cls->load($name); return $cls; @@ -21,6 +24,10 @@ namespace Lollipop { function where(string $table_name, array $vars) { + /* this function accepts a table name and an array[$column_name => $value] + * statement is select * from $table_name where $column_name = $value AND etc... + * returns an array of objects + */ if (!sizeof($vars)) { return []; } @@ -58,6 +65,9 @@ namespace Lollipop { function all(string $table_name) { + /* loads whole table $table_name + * returns array of objects + */ $cls = new $table_name($this); $sql = "SELECT {$cls->get_primary()} FROM {$cls->get_table()}";