Beispiel #1
1
 function form_insert($table)
 {
     $p = the::app();
     $db = the::database();
     //insert
     $fields = "";
     $values = "";
     $data = array($table);
     foreach ($_POST as $key => $value) {
         if ($key[0] == "_") {
             $key = substr($key, 1);
             $fields .= ",`%s`";
             $f[] = $key;
             $values .= ", '%s'";
             $v[] = $p->post("_" . $key);
         }
     }
     $data = array_merge($data, $f, $v);
     $fields = substr($fields, 1);
     $values = substr($values, 1);
     $insert_query = "insert into %s (" . $fields . ") values (" . $values . ")";
     $db->querry($insert_query, $data);
 }
Beispiel #2
1
 function hello_mysql()
 {
     $db = the::database();
     $result = $db->hello_mysql();
     return $result[0]['today'];
 }