@@ -21,7 +21,6 @@ $connect->setPrefix("maple_");
2121$connect->execute();
2222
2323```
24-
2524## Make queries
2625Start with the namespace
2726``` php
@@ -30,10 +29,12 @@ use MaplePHP\Query\DB;
3029
3130### Select 1:
3231``` php
33- $select = DB::select("id,firstname,lastname", "users a" )->whereId(1)->where("status", 0, ">")->limit(1);
34- $select->join("login b" , "b .user_id = a .id");
32+ $select = DB::select("id,firstname,lastname", [ "users", "aliasA"] )->whereId(1)->where("status", 0, ">")->limit(1);
33+ $select->join([ "login", "aliasB"] , "aliasB .user_id = aliasA .id");
3534$obj = $select->get(); // Get one row result as object
3635```
36+ * Default alias will be the table name e.g. users and login if they were not overwritten.*
37+
3738### Select 2:
3839``` php
3940$select = DB::select("id,name,content", "pages")->whereStatusParent(1, 0);
@@ -97,12 +98,14 @@ $select->orderRaw("id ASC, parent DESC");
9798```
9899### Join
99100``` php
100- $select->join("tableName ", "b .user_id = a .id"); // Default INNER join
101+ $select->join(["login ", "aliasB"], ["aliasB .user_id" => "aliasA .id"] ); // PROTECTED INPUT
101102$select->join("tableName", "b.user_id = '%d'", [872], "LEFT"); // PROTECTED INPUT
102- $select->joinInner("tableName", "b.user_id = a.id");
103- $select->joinLeft("tableName", "b.user_id = a.id");
104- $select->joinRight("tableName", "b.user_id = a.id");
105- $select->joinCross("tableName", "b.user_id = a.id");
103+ $select->join("tableName", "b.user_id = a.id"); // "UNPROTECTED" INPUT
104+
105+ $select->joinInner("tableName", ["b.user_id" => "a.id"]);
106+ $select->joinLeft("tableName", ["b.user_id" => "a.id"]);
107+ $select->joinRight("tableName", ["b.user_id" => "a.id"]);
108+ $select->joinCross("tableName", ["b.user_id" => "a.id"]);
106109```
107110### Insert
108111``` php
0 commit comments