本帖最后由 jeiryc 于 2009-12-31 15:42:44 编辑

解决方案 »

  1.   

    global $db 下。在head.php里
      

  2.   

    把 include_once 改成 include 试试
      

  3.   

    select() 你写成函数,我真汗。
      

  4.   

    你把,$db=new DB(dbhost,dbuser,dbpass,dbname);
    产生的$db 传参传进去吧,function load_class($conditions1,&$db){
            //include_once 'conn.php';
            include_once('feipicadmin/db.php');//类文件
            $result = $db->select("select channel_folder from feipic_chennel where channel_id = $conditions1");
    for($i=0;$i<count($result);$i++){
    echo = $result[$i][0];
    }
        //
    }
     load_class($conditions1=2);
      

  5.   

    load_class函数内要global $db;或者$GLOBALS['db']->select
      

  6.   

    上面那个调用的时候少传了一个参数哈,代码说话demo
    <?php
    class test{
    function print_echo(){
    echo 'right';
    }
    }
    $db = new test();
    function test2(&$db)  //把对象传进去
    {
    $db->print_echo();
    }
    test2(&$db);  //调用
    ?>