Перейти к содержанию

sanoma

Пользователи
  • Постов

    2
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные sanoma

  1. Здравствуйте....

    у меня проблема с одним таском...

    я пытаюсь вытащить с 3х таиблов результаты а потом их умножыть и прибавить друг другу...

    но у меня проблема с sql-ом, никак не смог исправить...

    так помогите люди добрые поделитесь знанием...

    вот скрип



    <?php


    if ( ! defined( 'IN_IPB' ) )
    {
    print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
    exit();
    }

    /**
    *
    * @class task_item
    * @brief Task to update the profile views from the temporary table
    *
    */
    class task_item
    {
    /**
    * Object that stores the parent task manager class
    *
    * @var $class
    */
    protected $class;

    /**
    * Array that stores the task data
    *
    * @var $task
    */
    protected $task = array();

    /**
    * Registry Object Shortcuts
    *
    * @var $registry
    * @var $DB
    * @var $lang
    */
    protected $registry;
    protected $DB;
    protected $lang;

    /**
    * Constructor
    *
    * @param object $registry Registry object
    * @param object $class Task manager class object
    * @param array $task Array with the task data
    * @return @e void
    */
    public function __construct( ipsRegistry $registry, $class, $task )
    {
    /* Make registry objects */
    $this->registry = $registry;
    $this->DB = $this->registry->DB();
    $this->lang = $this->registry->getClass('class_localization');

    $this->class = $class;
    $this->task = $task;
    }

    /**
    * Run this task
    *
    * @return @e void
    */
    public function runTask()
    {
    $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_global' ), 'core' );

    /*
    $this->DB->build( array( 'select' => 'posts, COUNT(*) as posts', 'eco_points, COUNT(*) as eco_points',
    'from' => 'members', 'pfields_content',
    'group' => 'member_id'
    ) );
    */
    // And finally, a complex build query showing all available parameters
    $this->DB->build( array(
    'select' => 't.*',
    'from' => array( 'members' => 't' ),
    'group' => 't.member_id',
    'add_join' => array(
    array(
    'select' => 'm.*',
    'from' => array( 'pfields_content' => 'm' ),
    'where' => 'm.member_id=t.member_id',
    'type' => 'left',
    ),
    array(
    'select' => 'o.*',
    'from' => array( 'profile_portal' => 'o' ),
    'where' => 'o.pp_member_id=m.member_id',
    'type' => 'left',
    ),
    )

    ) );








    //$z =
    $this->DB->execute();
    //while( $this->DB->fetch( $z ) )
    // {


    $sanoma = $o['time_spent'] + 80 * $m['eco_points'] / 4 + $t['posts'] * 100;


    //----------------------------------------
    // Update...
    //-----------------------------------------

    $this->DB->update( 'pfields_content', "bounty=" .$sanoma, "member_id=" .$t['member_id'], FALSE, TRUE );
    // $this->DB->update( 'pfields_content', 'bounty='. $sanoma, 'member_id=1', true, true );

    // }
    //-----------------------------------------
    // Delete from table
    //-----------------------------------------

    //$this->DB->delete( 'bounty' );

    //-----------------------------------------
    // Log to log table - modify but dont delete
    //-----------------------------------------

    $this->class->appendTaskLog( $this->task, $this->lang->words['task_bounty'] );

    //-----------------------------------------
    // Unlock Task: DO NOT MODIFY!
    //-----------------------------------------

    $this->class->unlockTask( $this->task );
    }
    }

    спасибо заранее...

×
×
  • Создать...