Forums / National / Russian / Тех. поддержка / Запросы документации

Принимаем вопросы от населения

Nik Samokhvalov
#34146 2012-05-01 19:28

Таблица объявлена, колонка существует. Пробовал сделать простой запрос:

<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=page.edit.update.done
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

require_once cot_langfile('pagethumbs', 'plug', 'config');
require_once 'system/uploads.php';

$pagethumbs['paget_pageid'] = $id;
$pagethumbs['paget_alt'] = cot_import('rpagethumbs_alt', 'P', 'TXT');
$pagethumbs['paget_url'] = '';
$paget_url = '';

if (isset($_POST['rpagethumbs_delete']))
{
	$oldthumbs = $db->query("SELECT paget_url FROM $db_pages_thumbs WHERE paget_pageid='$id'")->fetch();
	if ($oldthumbs['paget_url'] != '')	unlink($oldthumbs['paget_url']);
	$db->query("DELETE $db_pages_thumbs WHERE paget_pageid='$id'");
}

if ($_FILES['rpagethumbs_file']['name'] != '')
{
	if ($_FILES['rpagethumbs_file']['error'] == 0)
	{
		$oldthumbs = $db->query("SELECT paget_url FROM $db_pages_thumbs WHERE paget_pageid='$id'")->fetch();
		if ($oldthumbs['paget_url'] != '')	unlink($oldthumbs['paget_url']);
		
		$pagethumbs['paget_url'] = $item_id.rand(10, 99).".".end(explode('.', $_FILES['rpagethumbs_file']['name']));
		$paget_path = $pagethumbs_catalog."/".$pagethumbs['paget_url'];
		
		move_uploaded_file($_FILES['rpagethumbs_file']['tmp_name'], $page_thumbs['path']);
		cot_imageresize($paget_path, $paget_path, 
						$cfg['plugin']['pagethumbs']['paget_width'], 
						$cfg['plugin']['pagethumbs']['paget_height'], 
						'fit', '#000', 100, true);
						
		$paget_url = " , paget_url='".$pagethumbs['paget_url']."'";
	}
	else	cot_error($L['Error_pagethumbs_load']);
}

$db->query("SELECT * FROM $db_pages_thumbs");

?>

Всё равно получаю ошибку:

Fatal error
2012-05-01 19:30

SQL error 42000: Syntax error or access violation: 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 '' at line 1

#0  cot_diefatal(SQL error 42000: Syntax error or access violation: 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 '' at line 1) called at [X:\home\cot-max.ru\www\system\database.php:449]
#1  CotDB->query(SELECT * FROM ) called at [X:\home\cot-max.ru\www\plugins\pagethumbs\pagethumbs.page.edit.php:47]
#2  include(X:\home\cot-max.ru\www\plugins\pagethumbs\pagethumbs.page.edit.php) called at [X:\home\cot-max.ru\www\modules\page\inc\page.edit.php:193]
#3  require_once(X:\home\cot-max.ru\www\modules\page\inc\page.edit.php) called at [X:\home\cot-max.ru\www\modules\page\page.php:43]
#4  require_once(X:\home\cot-max.ru\www\modules\page\page.php) called at [X:\home\cot-max.ru\www\index.php:96]
Sorry for my English.