DATABASE ERROR
DATABASE ERROR:
SELECT *,DATE_FORMAT(pubdate, '%d.%m.%Y') AS fpubdate FROM cms_concurs_photos
WHERE title <> '' AND c_id = 44 AND user_id = 1 ORDER BY 14 DESC, pubdate DESC 0
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 '0' at line 2
Подскажите, пожалуйста, где копать.
public function getPhotos($c_id=0, $user_id=0, $order='id', $limit=0) {
$inCore = cmsCore::getInstance();
$cfg = $inCore->loadComponentConfig('concurs');
if ($c_id) {$where = " AND c_id = {$c_id}";}
if ($user_id) {$where .= " AND user_id = {$user_id}";}
if ($limit) {$limit = "LIMIT {$limit}";}
$sql = "SELECT *,DATE_FORMAT(pubdate, '%d.%m.%Y') AS fpubdate FROM cms_concurs_photos
WHERE title <> '' {$where} ORDER BY {$order} DESC, pubdate DESC {$limit}";
$res = $this->inDB->query($sql);
if (!$this->inDB->num_rows($res)){ return false; }
while ($item = $this->inDB->fetch_assoc($res)){
$item['user'] = $this->get_user_info($item['user_id']);
$item['pubdate'] = $inCore->dateFormat($item['pubdate']);
$item['comments'] = $inCore->getCommentsCount('concursitem', $item['id']);
if ($item['filename']) {
$item['file'] = '/images/concurs/medium/'.$item['filename']; } else {
$file = $this->inDB->get_field('cms_user_photos', "id={$item['f_id']}", 'imageurl');
$item['file'] = '/images/users/photos/medium/'.$file;
}
$photos[] = $item;
}
return $photos;
}
У вас почему то переменная {$order} вместо "pubdate" или "hits" в даном случае равна 14
Можно в личку подробности?
Это нормально, ув. deltas никогда не включает режим отладки и:the right syntax to use near '0'
идёт в запрос.$limit=0