1

(98 replies, posted in PunBB 1.3 extensions)

I don't know the case.

The error occurred on line 157 in E:\qzstudio\phsite\extensions\pun_attachment\include\attach_func.php

Database reported: Field 'owner_id' doesn't have a default value (Errno: 1364).
vankon wrote:

punbb version 1.3 final

The search engine is very well for English, but is not good for Chinese.
it only can get Result for English, no Result for Chinese!

i debug the code ,find that

include/search_functions.php
@108 'WHERE' statement

$query = array(
                        'SELECT'    => 'm.post_id',
                        'FROM'        => 'search_words AS w',
                        'JOINS'        => array(
                            array(
                                'INNER JOIN'    => 'search_matches AS m',
                                'ON'            => 'm.word_id=w.id'
                            )
                        ),
                        'WHERE'        => 'w.word LIKE \''.$forum_db->escape(str_replace('*', '%', $cur_word)).'\''
                    );

$query value is like

SELECT m.post_id FROM search_words AS w INNER JOIN search_matches AS m ON m.word_id=w.id WHERE w.word LIKE '数据库'

my debug code is

echo 'search_functions.php@116@query=SELECT '.$query['SELECT'].' FROM '.$query['FROM'].' INNER JOIN '.'search_matches AS m'. ' ON '.'m.word_id=w.id'.' WHERE '.$query['WHERE'];

url is http://cilinux.cn/forum2/search.php?act … C%E7%B4%A2

the keywords is '数据库', in English is 'database'

the final sql statement missing '%' around keywords.

maybe ths bug in all non English language.

the code

'WHERE'        => 'w.word LIKE \''.$forum_db->escape(str_replace('*', '%', $cur_word)).'\''

modify to

'WHERE'        => 'w.word LIKE \'%'.$forum_db->escape(str_replace('*', '%', $cur_word)).'%\''

then OK for keyword: '数据库'

but other keywords also have no Result.

most language is single byte/character, but Chinese is double byte/character(word) ,
in utf-8, most Chinese Word is 2 byte, other is 3byte or 4 byte.

this is a problem!

so on.

这个非常好……谢谢分享