|
Title: query problem Post by: hotdesc on January 07, 2009, 06:38:18 PM plz help me
Code: function clean() { if ($this->result = $GLOBALS['db']->query("SELECT * FROM chat WHERE 1 = 1 GROUP BY chatid")) { foreach ($this->result as $key => $val) { if (!$GLOBALS['db']->query("SELECT * FROM sessions WHERE chatid='".$this->result[$key]['chatid']."'")) { $this->result2 = $GLOBALS['db']->query("SELECT * FROM chat WHERE chatid='".$this->result[$key]['chatid']."' ORDER BY timestamp DESC LIMIT 1"); if ($this->result2[0]['timestamp'] < (time() - 3600)) { $GLOBALS['db']->query("DELETE FROM chat WHERE chatid='".$this->result[$key]['chatid']."'"); } } } } } SELECT * FROM chat WHERE 1 = 1 GROUP BY chatid give erros in postgresql Title: Re: query problem Post by: hotdesc on January 07, 2009, 07:51:32 PM Solved. . . .
new error Code: function referrers($limit = 25) { $this->result = $GLOBALS['db']->raw_query('SELECT `url`, COUNT(*) AS `count` FROM `'.$GLOBALS['conf']['prefix'].'stats_referrers` GROUP BY `url` ORDER BY `count` DESC LIMIT '.$limit, 'stats_referrers'); if ($this->result[0]) { foreach ($this->result as $key => $val) { if (strlen($this->result[$key]['url']) > 75) { $this->result[$key]['title'] = substr($this->result[$key]['url'], 0, 55).'...'.substr($this->result[$key]['url'], -20, 20); } else { $this->result[$key]['title'] = $this->result[$key]['url']; } } } return $this->result; } Code: 'SELECT `url`, COUNT(*) AS `count` FROM `'.$GLOBALS['conf']['prefix'].'stats_referrers` GROUP BY `url` ORDER BY `count` DESC LIMIT '.$limit, 'stats_referrers' String in LIMIT? Title: Re: query problem Post by: hotdesc on January 09, 2009, 01:33:09 PM resolved
|