if (empty($this->pdo)) return false;
# Type
- if (!$this->type(null)) $this->bye("unknow type = `".$this->type."`");
+ if (!$this->type(null)) $this->bye("Unknow type = `".$this->type."`");
# Connect
if ($this->type('use_path') and !is_readable($this->name)) {
#if (isset($this->pdo_error)) $this->conn->setAttribute($this->pdo_error[0], $this->pdo_error[1]);
} catch (PDOException $e) {
- throw new CustomException('Connection failed: ' . $e->getMessage(), (int)$e->getCode( ));
+ throw new Exception('Connection failed: ' . $e->getMessage(), (int)$e->getCode( ));
self::bye('Connection failed: ' . $e->getMessage());
}
}
public function fields_keys(&$others=array()) {
-
+
$fields_keys = array();
foreach ($this->fields() as $name => $f) {
foreach (array_diff(self::$params,$ignore) as $p) {
if ($v=self::p($p)) {
if (self::p('debug')) $h .= "<label>$p</label>";
- $h .= '<input type="'.(self::p('debug')?'text':'hidden').'" name="'.$p.'" value="'.$v.'"/>';
+ $h .= '<input type="'.(self::p('debug')?'text':'hidden').'" name="'.$p.'" value="'.$v.'"/>'.NB_EOL;
}
}
return $h;
$next = 999999;
}
- /*
- if ($prev>=0) $html .= '<li class="prev"><a href="'.$this->url_list('limit',preg_replace('/^0,/','',"$prev,$y")).'"><<</a></li>';
-
- $html .= '<li class="count">'.($tot ? ($x+1) : 0).' - '.( $count<($x+$y) ? $count : ($x+$y) ).' / '.$tot.' results</li>';
-
- if ($next<$tot) $html .= '<li class="prev"><a href="'.$this->url_list('limit',"$next,$y").'">>></a></li>';
-
- if ($html) $html = ''
- .'<nav>'.NB_EOL
- .'<li>'.NB_EOL
- .$html
- .'</li>'.NB_EOL
- .'</nav>'.NB_EOL
- ;
- */
if ($prev>=0) $html .= '<span class="prev"><a href="'.$this->url_list('limit',preg_replace('/^0,/','',"$prev,$y")).'"><<</a></span> ';
$html .= '<span class="count">'.($tot ? ($x+1) : 0).' - '.( $count<($x+$y) ? $count : ($x+$y) ).' / '.$tot.' results</span>';
if ($opt['is_html'] and !$this->p('action') and !$this->p('inc')) {
echo $this->html_menu();
-
- } elseif ($opt['is_html'] and !$this->p('inc')) {
- echo $this->form_hidden();
-
}
- if ($opt['is_html']) echo '<div class="results">'.NB_EOL;
+ if ($opt['is_html']) {
+ echo '<div class="results">'.NB_EOL;
+ if (!$this->p('inc')) echo $this->form_hidden();
+ }
# Use the module out when format unknow
$out_conf = null;
$query = $this->db()->conn->query($select_count[1]);
} elseif ($where) {
- $debug = "Table.rows(): Using $sql_count";
$sql_count = $sql;
$sql_count = preg_replace('/ (ORDER|LIMIT) .*?$/s','',$sql_count);
$sql_count = preg_replace('/^SELECT .*FROM/s','SELECT count(*) FROM ',$sql_count);
+ $debug = "Table.rows(): Using $sql_count";
$query = $this->db()->conn->query($sql_count);
} else {