4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 30, 2010, 04:39:51 AM

Login with username, password and session length
Search:     Advanced search
4images is now on facebook. Click here and become a fan!
Translate this page with google
=>
 Translate this page with Google =>
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Help / Hilfe
| |-+  Error Messages / Fehlermeldungen
| | |-+  Unknown column 'i.user_id' in 'on clause'
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Unknown column 'i.user_id' in 'on clause'  (Read 11285 times)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17088

Thank You
-Given: 21
-Receive: 191

mmm PHP...


View Profile WWW
« on: September 07, 2008, 01:39:52 PM »

This error occur when used 4images v1.7 / 1.7.1 (and/or some old mods) and MySQL v5.x
It caused by the changes in MySQL v5 handling multiple tables on one query.
If your 4images is newer then v1.7.1 and you still get these errors, then you must have installed a mod that is not MySQL v5 compatible.

There are three ways fix the problem:
1) Downgrade MySQL to v3 or v4
2) Upgrade your 4images
3) In .php files replace all
FROM table1 ref, table2 ref

with:
FROM (table1 ref, table2 ref)


There are quiet a few places needs to be fixed, so I'd recommend use a text editor which allows use unix regular expressions to search and modify files.

This REGEX string I've used in UltraEdit:
1
(FROM\s+)("\.[A-Z_]+\."\s+[a-z]+,\s*"\.[A-Z_]+\."\s+[a-z]+)
and in replacing string used:
it worked quiet well. That editor allows search and replace string in files without opening them in the editor, which would be the fastest way, however I'd strongly recommend do a complete backup of all .php files before you attempt doing it.

I corrected this problem by running a perl command from the shell in the 4images root dir, the \admin dir and the \includes dir:

1
perl -pi '-es/(FROM\s+)("\.[A-Z_]+\."\s+[a-z]+,\s*"\.[A-Z_]+\."\s+[a-z]+)/$1($2)/g' *.php

This might be useful for people without access to Ultraedit.
Remember to BACK UP everything before you try this!


If you don't have such editor or for any other reasons can't use that REGEX, prepare yourself for a long journey modifying almost all 4images files manually.
The list below is only for non-modified 4images v1.7 / 1.7.1 That means if after fixing all these files you still getting errors there are only two reasons:
1) you missed a modification
2) you've installed a mod that also not MySQL v5 compatible.

In any case you'll need find and fix the problem yourself.

Hopefully after looking at the list below you'll understand what has to be changed.

Good luck.

Find in categories.php:
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)


Find in details.php:
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)


Find in index.php:
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)


Find in lightbox.php:
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)



Find in member.php (4 times):
1
FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
Replace with:
1
FROM (".COMMENTS_TABLE." c, ".IMAGES_TABLE." i)


Find in postcards.php:
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)



Find in postcards.php:
1
FROM ".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i
Replace with:
1
FROM (".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i)



Find in search.php:
1
FROM ".WORDLIST_TABLE." w, ".WORDMATCH_TABLE." m
Replace with:
1
FROM (".WORDLIST_TABLE." w, ".WORDMATCH_TABLE." m)


Find in search.php:
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)


Find in top.php (4 times):
1
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)


Find in admin\comments.php:
1
FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
Replace with:
1
FROM (".COMMENTS_TABLE." c, ".IMAGES_TABLE." i)



Find in admin\home.php:
1
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
Replace with:
1
FROM (".USERS_TABLE." u, ".SESSIONS_TABLE." s)


Find in admin\usergroups.php:
1
FROM ".GROUPS_TABLE." g, ".GROUP_MATCH_TABLE." gm
Replace with:
1
FROM (".GROUPS_TABLE." g, ".GROUP_MATCH_TABLE." gm)


Find in includes\auth.php:
1
FROM ".GROUP_ACCESS_TABLE." a, ".GROUP_MATCH_TABLE." m
Replace with:
1
FROM (".GROUP_ACCESS_TABLE." a, ".GROUP_MATCH_TABLE." m)



Find in includes\functions.php (2 times):
1
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
Replace with:
1
FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)


Find in includes\sessions.php:
1
FROM ".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
Replace with:
1
FROM (".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l)

« Last Edit: August 20, 2009, 04:19:35 PM by V@no » Logged

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)
sanko86
Sr. Member
****
Offline Offline

Posts: 310

Thank You
-Given: 0
-Receive: 3


View Profile WWW
« Reply #1 on: January 25, 2009, 01:27:16 PM »

thanks admin.
Logged

Web site:http://www.anlatiyoruz.com
Hayat zorluklarla doludur.Ama en zoru insanın insana düşmanlığıdır.
nabeel(banned)
Pre-Newbie

Offline Offline

Posts: 3

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #2 on: August 22, 2009, 10:19:11 AM »

very nice
Logged

REMOVED
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
piqs.de - Fotocommunity & lizenzfreie Fotos