public function get_latest_running_entry() { $table = $this->getTimeSheetTable(); $projectTable = $this->getProjectTable(); $activityTable = $this->getActivityTable(); $customerTable = $this->getCustomerTable(); $select = "SELECT {$table}.*, {$projectTable}.name AS projectName, {$customerTable}.name AS customerName, {$activityTable}.name AS activityName, {$customerTable}.customerID AS customerID\n FROM {$table}\n JOIN {$projectTable} USING(projectID)\n JOIN {$customerTable} USING(customerID)\n JOIN {$activityTable} USING(activityID)"; $result = $this->conn->Query("{$select} WHERE end = 0 AND userID = " . $this->kga['user']['userID'] . " ORDER BY timeEntryID DESC LIMIT 1"); if (!$result) { return null; } return $this->conn->RowArray(0, MYSQLI_ASSOC); }