Author Topic: hilfe!!!!!DB Error  (Read 17199 times)

0 Members and 1 Guest are viewing this topic.

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
hilfe!!!!!DB Error
« on: May 03, 2005, 02:46:22 PM »
Hilfe, ich habe mist gebaut ich wollte meine Seite aufräumen und dadurch ist ein Fehler entstanden, dann habe ich versucht mit ein  backup was ich gemacht hate wieder den fehler zu beheben aber das klapt nicht.

DB Error: Bad SQL Query: SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images FROM 4images1_categories c LEFT JOIN 4images1_images i ON (i.cat_id = c.cat_id AND i.image_date >= AND i.image_active = 1) GROUP BY c.cat_id ORDER BY cat_name ASC
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 'AND i.image_active = 1) GROUP BY c.cat_id ORDER BY cat_name AS' at line 3

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #1 on: May 04, 2005, 11:10:03 AM »
Der Fehler ist in search.php. Suche nach

Code: [Select]
$sql_where_query .= "AND i.image_date >= $new_cutoff ";
Der komplette Abschnitt sollte so aussehen:

Code: [Select]
  if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #2 on: May 04, 2005, 02:16:02 PM »
also bei mir steht das :

  $sql_where_query = "";

  if (!empty($search_id['image_ids'])) {
    $sql_where_query .= "AND i.image_id IN (".$search_id['image_ids'].") ";
  }

  if (!empty($search_id['user_ids'])) {
    $sql_where_query .= "AND i.user_id IN (".$search_id['user_ids'].") ";
  }

  if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }


welchen auschnit solte ich austauschen?
Der eine abschnitt den du mir gesagt hast steht ja schon drin :

  if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #3 on: May 04, 2005, 02:35:20 PM »
Benutzt Du noch Version 1.7? Dann schau mal in global.php ob folgender Abschnitt so drin steht

Code: [Select]
  $new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);
  $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
          FROM ".CATEGORIES_TABLE." c
          LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
          GROUP BY c.cat_id
          ORDER BY c.cat_order, c.cat_name ASC";
  $result = $site_db->query($sql);

Kommt direkt nach

Code: [Select]
if (defined("GET_CACHES")) {
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #4 on: May 04, 2005, 03:06:18 PM »
NEIN DA STEHT DAS DRIN:


if (defined("GET_CACHES")) {
  $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
         FROM ".CATEGORIES_TABLE." c
         LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
         GROUP BY c.cat_id
         ORDER BY ".$config['cat_order']."";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $cat_cache[$row['cat_id']] = $row;
    $cat_parent_cache[$row['cat_parent_id']][] = $row['cat_id'];
  }
  $site_db->free_result();
ah und dan kommt:


// --------------------------------------

  $new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);

  $sql = "SELECT cat_id, COUNT(image_id) AS new_images
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_date >= $new_cutoff
          GROUP BY cat_id";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $new_image_cache[$row['cat_id']] = $row['new_images'];
  }
  $site_db->free_result();

  // --------------------------------------


Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #5 on: May 04, 2005, 03:32:45 PM »
Ja, ist der Fehler denn weg wenn Du nach

Code: [Select]
if (defined("GET_CACHES")) {
das einfügst

Code: [Select]
$new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #6 on: May 04, 2005, 03:35:53 PM »
das steht ja schon drin also so steht das in  global.php


if (defined("GET_CACHES")) {
  $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
         FROM ".CATEGORIES_TABLE." c
         LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
         GROUP BY c.cat_id
         ORDER BY ".$config['cat_order']."";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $cat_cache[$row['cat_id']] = $row;
    $cat_parent_cache[$row['cat_parent_id']][] = $row['cat_id'];
  }
  $site_db->free_result();

  // --------------------------------------

  $new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);

  $sql = "SELECT cat_id, COUNT(image_id) AS new_images
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_date >= $new_cutoff
          GROUP BY cat_id";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $new_image_cache[$row['cat_id']] = $row['new_images'];
  }
  $site_db->free_result();

  // --------------------------------------

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #7 on: May 04, 2005, 03:39:19 PM »
Nein, tut es nicht. Bitte lies dir meine Posts genau durch. Es muss nach

Code: [Select]
if (defined("GET_CACHES")) {
stehen.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #8 on: May 04, 2005, 03:42:01 PM »
soll ich das was drunter ist loschen und da zu schreiben oder einfugen?

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #9 on: May 04, 2005, 03:43:09 PM »
So wie ich es bereits hier beschrieben habe.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #10 on: May 04, 2005, 03:45:20 PM »
ja gut aber sol ich das :if (defined("GET_CACHES")) { löschen und dan das einfugen $new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #11 on: May 04, 2005, 03:46:54 PM »
Nein, Du sollst es so machen wie ich es hier beschrieben habe.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #12 on: May 04, 2005, 03:48:00 PM »
ja das habe ich der fehler ist immer noch da!

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: hilfe!!!!!DB Error
« Reply #13 on: May 04, 2005, 03:49:12 PM »
Poste den Abschnitt nach

Code: [Select]
if (defined("GET_CACHES")) {
nochmal hier rein.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline nova2004de

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: hilfe!!!!!DB Error
« Reply #14 on: May 04, 2005, 03:50:48 PM »
if (defined("GET_CACHES")) {
  $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
         FROM ".CATEGORIES_TABLE." c
         LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
         GROUP BY c.cat_id
         ORDER BY ".$config['cat_order']."";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $cat_cache[$row['cat_id']] = $row;
    $cat_parent_cache[$row['cat_parent_id']][] = $row['cat_id'];
  }
  $site_db->free_result();

  // --------------------------------------

  $new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);

  $sql = "SELECT cat_id, COUNT(image_id) AS new_images
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_date >= $new_cutoff
          GROUP BY cat_id";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $new_image_cache[$row['cat_id']] = $row['new_images'];
  }
  $site_db->free_result();

  // --------------------------------------


hir getes naturlich weiter.