Visualizzazione dei risultati da 1 a 2 su 2

Discussione: ADOdb come usarlo?

  1. #1

    ADOdb come usarlo?

    ho uno script che usa la libreria ADOdb.
    ho un problema.
    mi ripete una query infinitamente.
    come posso risolvere???
    ecco il codice
    PS: la query è la seconda
    Codice PHP:
    <?php
    class Index extends config
    {
        var 
    $smarty;
        var 
    $cache;
        var 
    $db;
        var 
    $l;
        var 
    $paginazione;
        
    /** 
        *
        * @package fms
        * @version $Id: index.php,v 0.01 beta 2006/06/11 18:13:49 acydburn Exp $
        * @copyright (c) francesco straffi
        * @license [url]http://opensource.org/licenses/gpl-license.php[/url] GNU Public License 
        *
        */
        
    function getmicrotime(){
           list(
    $usec$sec) = explode(" ",microtime());
           return ((float)
    $usec +  substr((float)$sec,0,1));
        } 
        
        function 
    Index()
        {
            
    $this->path();
            
    $inizio=$this->getmicrotime();
            
            include_once(
    $this->sitedir '/includes/php/libs/Smarty.class.php');
            include_once(
    $this->sitedir '/includes/php/cache/acm_file.php');
            include_once(
    $this->sitedir '/includes/php/Db/adodb.inc.php');
            include_once(
    $this->sitedir '/includes/php/Db/adodb-exceptions.inc.php');
            
            
    $this->cache = new acm($this->sitedir);
            
    $this->smarty = new Smarty();
            
    //mi connetto
            
    try{
                
    $this->db NewADOConnection('mysql');
                
    $this->db->Connect($this->host$this->user$this->pass$this->dbname);
            } catch(
    Exception $e){
                echo 
    "Connect Failed";
                
    adodb_pr($e);
                die();
            }
            
    $this->db->debug=1;
            
            
    $this->smarty->template_dir     $this->sitedir.'/Theme/'.'classic';
            
    $this->smarty->compile_dir      $this->sitedir.'/cache';
            
    $this->smarty->config_dir       $this->sitedir.'/Theme/'.'classic'.'/config';
            
    $this->smarty->compile_check    true;
            
    $this->smarty->debugging        false;
                    
            if((
    $menucache[0] = $this->cache->get('_menu')) == false)
            {
                
    $sql "SELECT id, url, nome, visible
                    FROM "
    .$this->prefix."page
                    ORDER BY id    ASC
                    LIMIT 0,10
                    "
    ;
                
    $ADODB_FETCH_MODE ADODB_FETCH_ASSOC;
                
    $result $this->db->GetAssoc($sql);
                
                
    $i 0;
                
                foreach(
    $result as $key => $menu)
                {
                    if(
    $menu['visible'] == 1)
                    {
                        if(
    preg_match('/http:\/\/(.*?)/is'$menu['url']))
                        {
                            
    $men[$i++] = $menu;
                        } else {
                            
    $men[$i++]          = $menu;
                            
    $men[$i 1]['int'] = true;
                        }
                    }
                }
                
                
    $this->cache->put('_menu'$men3600);
            }
            
            
    $menu $menucache[0] == false $men $menucache[0];

            
    $p $_GET['page'];
            
            if(!
    file_exists($this->sitedir.'/page/'.$p.'.php'))
            {
                
    $p 'error';
            }
                   
    //query danneggiata, che si ripete fino a bloccare il server.
    //
    //
    //
    //
    //
            
    $sql "SELECT u.id, u.urlo, u.user_id, u.time, p.username, p.user_id
                FROM "
    .$this->prefix.'shout u,
                phpbb_users p
                WHERE u.user_id = p.user_id
                ORDER BY time DESC'
    ;
            
    $shout $this->db->GetOne($sql);

            include_once(
    $this->sitedir.'/page/'.$p.'.php');
            
    $class='page_'.$p;
            
            
    $var['basedir'] = $this->sitedir;
            
    $var['title'] = $this->title;
            
    $var['forumurl'] = $this->forumurl;
            
    $var['siteurl'] = $this->siteurl;
            
    $var['p'] = $p;
            
    $var['shout'] = $shout;
            
    $var['menu'] = $menu;
            
    $var['tquery'] = '5';
            
    $var['gzip'] = $this->gzip;
            
            foreach(
    $var as $name => $value){
                
    $this->smarty->assign($name$value);
            }

            
    $page=new $class();
            
    $page->page();
            
            
    $page $this->smarty->fetch('header.tpl');
            
    $pg $this->smarty->fetch('page/'.$_GET['page'].'.tpl');
            
    $smarty->assign('page',$pg);
            
    $page .= $this->smarty->fetch('index.body.tpl');
            
            
    $fine=$this->getmicrotime();
            
    $time = ($fine $inizio);
            
            
    $this->smarty->assign('time',round($time,3));
            
            
    $page .= $this->smarty->fetch('footer.tpl');
            echo 
    $page;
        }
    }
    ?>

  2. #2

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.