Help Center Live Community
April 18, 2014, 09:10:26 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: query problem  (Read 2952 times)
hotdesc
Not too much to say...
*
Offline Offline

Posts: 13


« 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



Logged
hotdesc
Not too much to say...
*
Offline Offline

Posts: 13


« Reply #1 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?
Logged
hotdesc
Not too much to say...
*
Offline Offline

Posts: 13


« Reply #2 on: January 09, 2009, 01:33:09 PM »

resolved
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.152 seconds with 18 queries.

Google visited last this page March 21, 2014, 08:54:07 PM