Author Topic: DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...  (Read 70806 times)

0 Members and 1 Guest are viewing this topic.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...
« on: January 04, 2003, 08:52:13 AM »
Quote
DB Error: Bad SQL Query: SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND c.cat_id = i.cat_id ORDER BY RAND()
You have an error in your SQL syntax near 'RAND()' at line 5
This means that you have a mysql version that lower than required!
RAND() requires MySQL version >= 3.23.23

Solution:

Open "includes/constants.php" and change
Code: [Select]
define('SHOW_RANDOM_CAT_IMAGE', 1);to
Code: [Select]
define('SHOW_RANDOM_CAT_IMAGE', 0);
« Last Edit: March 15, 2005, 01:49:11 AM by Chris »
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline jaxeg

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...
« Reply #1 on: January 17, 2010, 03:22:20 PM »
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 1 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 9
Unknown column 'i.user_id' in 'on clause'
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\programs\Apache2.2\htdocs\gall2\includes\db_mysql.php on line 116

apache 2.2
php 5.3.1
mysql 5.1.42-community

pleas help my

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...
« Reply #2 on: January 17, 2010, 08:19:19 PM »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Arclight

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...
« Reply #3 on: January 29, 2011, 08:08:51 PM »
Hi,

After updating to version 1.7.9 i started to have problems with comments.

When uploading an image I sometimes get an error:
Code: [Select]
DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 9314, word_id, 0, 0, 1 FROM 4images_wordlist WHERE word_text = 'Pionki'
Duplicate entry '9314-5129' for key 1

Of course the word "Pionki" is an example, words differ. Sometimes i don't get any error at all, but some pictures uploaded after the update are not shown when i click on a keyword. It also happens when I add a keyword to a picture uploaded before the update.

Any ideas how to fix it?

Rembrandt

  • Guest
Re: DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...
« Reply #4 on: January 29, 2011, 09:43:35 PM »
Welcome in the Forum!
...After updating to version 1.7.9 i started to have problems with comments.....

fix:
http://www.4homepages.de/forum/index.php?topic=28860.msg154915#msg154915

mfg Andi

Offline Arclight

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: DB Error: Bad SQL Query: SELECT DISTINCT i.image_id ...
« Reply #5 on: February 05, 2011, 12:55:00 PM »
Hi!

Many thanks, but after applying the fix search engine still doesn't see two words like "SU45-156". It shows all pictures with a keyword "SU45" and not these with "SU45-156" only - when I (or someone else) enters the word "SU45-156" in the search box or by clicking on a keyword.

Any ideas how to fix it?

Thanks in advance.

Regards