Hello , I got the following error
Path
advanced-book-blocks/configure/0
Error message

user warning: Unknown column 'b.module' in 'on clause' query: SELECT mlid FROM book b LEFT JOIN i18n_blocks i18n ON (b.module = i18n.module AND b.delta = i18n.delta) WHERE (i18n.language ='en' OR i18n.language ='' OR i18n.language IS NULL) AND ( b.bid = 102 AND b.nid = b.bid) in /home/shefaya/public_html/sites/all/modules/advancedbookblocks/advancedbookblocks.module on line 194.

Any help ?

Comments

Majdi’s picture

After I took a look at the module ,
in line 194 we have
$mlid = db_result(db_query(db_rewrite_sql("SELECT mlid FROM {book} b WHERE b.bid = %d AND b.nid = b.bid","b","bid"), $bid));
I replace it with
$mlid = db_result(db_query(db_rewrite_sql("SELECT mlid FROM {book} b WHERE b.bid = %d AND b.nid = b.bid","{book}","bid"), $bid));

Any idea why is that ?
Thanks

PixelClever’s picture

I can't reproduce this. Deleting the alias doesn't seem like a good idea. Perhaps the mlid needs an alias in front of it? Try this:

$mlid = db_result(db_query(db_rewrite_sql("SELECT b.mlid FROM {book} b WHERE b.bid = %d AND b.nid = b.bid","b","bid"), $bid));
Majdi’s picture

I add the line

after i add it I got the following error

user warning: Unknown column 'b.module' in 'on clause' query: SELECT b.mlid FROM book b LEFT JOIN i18n_blocks i18n ON (b.module = i18n.module AND b.delta = i18n.delta) WHERE (i18n.language ='en' OR i18n.language ='' OR i18n.language IS NULL) AND ( b.bid = 112 AND b.nid = b.bid) in /home/shefaya/public_html/sites/all/modules/advancedbookblocks/advancedbookblocks.module on line 194.
user warning: Unknown column 'b.module' in 'on clause' query: SELECT b.mlid FROM book b LEFT JOIN i18n_blocks i18n ON (b.module = i18n.module AND b.delta = i18n.delta) WHERE (i18n.language ='en' OR i18n.language ='' OR i18n.language IS NULL) AND ( b.bid = 102 AND b.nid = b.bid) in /home/shefaya/public_html/sites/all/modules/advancedbookblocks/advancedbookblocks.module on line 194.
YanBoudreau’s picture

I replaced that line and the module is now working:

$mlid = db_result(db_query(db_rewrite_sql("SELECT mlid FROM {book} WHERE book.bid = %d AND book.nid = bid","book","bid"), $bid));

HansKuiters’s picture

@YanBoudreau: you replaced the alias with 'book'. Is that a good idea?

It seems that i18n is causing the problems. I had this working without the errors in a testsite which didn't had i18n installed.

After some testing: changing the alias 'b' to 'book' solves the errors. So there might be a problem with using the alias 'b'.

My changes to #194:

      $mlid = db_result(db_query(db_rewrite_sql("SELECT mlid FROM {book} book WHERE book.bid = %d AND book.nid = book.bid","book","bid"), $bid));
jvieille’s picture

I had this error, using i18n.
#5 fix it.

jvieille’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community