コード例 #1
0
 public static function doCall($sql, $return = true, $debug = false)
 {
     $DBobject = parent::init();
     //call the database
     $result = $DBobject->query($sql);
     if ($DBobject->errno) {
         $_SESSION['errors'][] = '<p>select failed: ' . $DBobject->error . '<br> statement was: <strong>' . $sql . '</strong></p>';
         return array();
     } elseif ($return == true) {
         $ret = array();
         while ($row = $result->fetch_assoc()) {
             $ret[] = $row;
         }
         return $ret;
     }
     if ($debug == true) {
         logfile::doLog(__FUNCTION__ . ' : $sql is ' . $sql);
     }
 }
コード例 #2
0
 public static function doCall($table, $primary, $wnummer, $data, $debug = false)
 {
     $DBobject = parent::init();
     $sql = "UPDATE {$table} SET ";
     foreach ($data as $key => $value) {
         if ($value == null) {
             $sql .= "{$key} = null, ";
         } else {
             $sql .= "{$key} = '{$value}', ";
         }
     }
     $sql = rtrim($sql, ", ");
     $sql .= " WHERE " . $primary . " = '" . $wnummer . "'";
     if ($debug == true) {
         logfile::doLog(__FUNCTION__ . ' : $sql is ' . $sql);
     }
     $DBobject->query($sql);
     if ($DBobject->errno) {
     }
 }