/** * public * * tables of database */ public function tables() { if (!empty($this->DB_Name) && is_string($this->DB_Name)) { $strPrepare = str_replace('{{ins-database}}', $this->DB_Name, $this->ShowTables); $res = $this->DatabasePointer->prepare($strPrepare); $res->execute(); $tablesOfDB = $res->fetchAll(PDO::FETCH_COLUMN); return $tablesOfDB; } else { trigger_error("Could not found database"); } }
/** * function unorded list (<ul><li>) * * @return void */ function ul1($showField = '', $id = '', $keyfield = 'id', $selectedAll = true) { if ($selectedAll) { $sql = "SELECT * FROM " . $this->table; if (isset($showField) && !empty($showField)) { $sql .= " ORDER BY " . $showField; } } else { if (empty($keyfield)) { throw new Exception('Invalid key field !', 13009898); } if (!is_string($keyfield)) { throw new Exception('Invalid key field, is not string value !', 13009897); } $keyfield = (string) $keyfield; $sql = "SELECT * FROM " . $this->table . " WHERE " . $keyfield . "=" . $id; if (isset($showField) && !empty($showField)) { $sql .= " ORDER BY " . $showField; } } $res = $this->DatabasePointer->prepare($sql); $res->execute(); $row = $res->fetchAll(PDO::FETCH_ASSOC); echo "<ul>"; print_r($row); foreach ($row as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { if (isset($showField) && !empty($showField)) { if ($showField == $k) { echo "<li>" . $v . "</li>"; } } else { echo "<li>" . $v . "</li>"; } } } } echo "</ul><br>"; }
/** * Rollback a transaction */ public function rollbackTransaction() { $this->DatabasePointer->rollBack(); }