sanoma Опубликовано 12 Июня 2012 Жалоба Поделиться Опубликовано 12 Июня 2012 Здравствуйте.... у меня проблема с одним таском... я пытаюсь вытащить с 3х таиблов результаты а потом их умножыть и прибавить друг другу... но у меня проблема с sql-ом, никак не смог исправить... он не работает после включения нечего не вводит в базу данных.... error log.[/color][color=#282828] Date: Tue, 12 Jun 2012 00:16:30 +0000 Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE member_id=' at line 1 IP Address: 95.104.65.208 - /forum/admin/index.php?adsess=36d479aee4f1d42b99f4b929e5db260b&app=core&module=system§ion=taskmanager&do=task_run_now&task_id=51&tab=members ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- mySQL query error: UPDATE kate_pfields_content SET bounty= WHERE member_id= .--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------. | File | Function | Line No. | |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------| | admin/applications/members/tasks/bounty.php | [db_main_mysql].update | 129 | '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------' | admin/applications/core/modules_admin/system/taskmanager.php | [task_item].runTask | 325 | '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------' | admin/applications/core/modules_admin/system/taskmanager.php | [admin_core_system_taskmanager].taskManagerRunTask | 97 | '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------' | admin/sources/base/ipsController.php | [admin_core_system_taskmanager].doExecute | 306 | '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------' вот скрип <?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 ); } } спасибо заранее... Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
siv1987 Опубликовано 12 Июня 2012 Жалоба Поделиться Опубликовано 12 Июня 2012 (изменено) mySQL query error: UPDATE kate_pfields_content SET bounty= WHERE member_id= $sanoma = $o['time_spent'] + 80 * $m['eco_points'] / 4 + $t['posts'] * 100; Что за переменные такие $o, $m, $t? Они нигде не определяются. Где фетч результата? У вас он закаментирован //while( $this->DB->fetch( $z ) ), к тому же еще неправильный - не присваивается переменной результат функции, неизвестный идентификатор $z. $this->DB->build( array( QUERY ) ); $this->DB->execute(); while( $row = $this->DB->fetch() ) { //code } Изменено 12 Июня 2012 пользователем siv1987 Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
sanoma Опубликовано 13 Июня 2012 Автор Жалоба Поделиться Опубликовано 13 Июня 2012 mySQL query error: UPDATE kate_pfields_content SET bounty= WHERE member_id= $sanoma = $o['time_spent'] + 80 * $m['eco_points'] / 4 + $t['posts'] * 100; Что за переменные такие $o, $m, $t? Они нигде не определяются. Где фетч результата? У вас он закаментирован //while( $this->DB->fetch( $z ) ), к тому же еще неправильный - не присваивается переменной результат функции, неизвестный идентификатор $z. $this->DB->build( array( QUERY ) ); $this->DB->execute(); while( $row = $this->DB->fetch() ) { //code } спасибо большое, исправил проблему.... Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
Рекомендуемые сообщения
Присоединиться к обсуждению
Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.