MyBB Community Forums

Full Version: Unknown column 'Array' in 'where clause'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've been working on migrationng 300k+ posts to mybb from vb. There is a pretty big problem with the search, any term returns this:

Quote:SQL Error:
1054 - Unknown column 'Array' in 'where clause'
Query:
SELECT pid, tid FROM mybb_posts WHERE pid IN(Array) AND visible >= 0 ORDER BY dateline DESC

There was also a small error with the private messages where it was pulling subject instead of title (line 133 convert\boards\vbulletin3\privatemessages.php).
Odd error this... can you look in the mybb_searchlog table, the posts and threads column, what's in them??
http://up2go.us/static/img/broken.png

I had a look at the post and thread tables as well and they look fine.
In search.php, from line 1250, find:

if($db->can_search == true)
{
	if($mybb->settings['searchtype'] == "fulltext" && $db->supports_fulltext_boolean("posts") && $db->is_fulltext("posts"))
	{
		$search_results = perform_search_mysql_ft($search_data);
	}
	else
	{
		$search_results = perform_search_mysql($search_data);
	}
}
else
{
	error($lang->error_no_search_support);
}
$sid = md5(uniqid(microtime(), 1));

replace with:

if($db->can_search == true)
{
	if($mybb->settings['searchtype'] == "fulltext" && $db->supports_fulltext_boolean("posts") && $db->is_fulltext("posts"))
	{
		$search_results = perform_search_mysql_ft($search_data);
		$search_type = "fulltext";
	}
	else
	{
		$search_results = perform_search_mysql($search_data);
		$search_type = "not fulltext";
	}
}
else
{
	error($lang->error_no_search_support);
}
echo "Search type: " . $search_type . "<br />";
print_r($search_results);
exit;
$sid = md5(uniqid(microtime(), 1));

Just determining which search type it's using, and also the results of the search. Can you perform a search, copy the output it'll show, paste it here, and then undo these changes so it won't affect other people. Someone else who had this issue said it was solved by re-merging but I'd rather find out the cause than just do that.
Yeah, I seen that thread. I've already merged 4 times so far.

Search type: not fulltext
Array ( [threads] => 159,473,614,706,1030,1321,1504,3197,3275,3356,3524,3781,4480,5546,5665,6729,7089,7235,7403,8134,8380,8476,8584,8732,8831,8947,8975,8978,8990,9017,9356,9398,9445,9468,9543,9623,9692,9795,9813,9829,9925,9959,10009,10132,10506 [posts] => Array ( ) [querycache] => )
wild guess, but you could check your threads table if the firstpost column is set for all threads

functions_search.php does not implode the posts array if there are no firstposts so it would return an array there
ahhhh, the majority of them are set to 0.
that's your error then

unfortunately no direct way to fix, as far as I'm aware even a recount&rebuild doesn't update firstpost
You can use this query but it's probably expensive

UPDATE mybb_threads t SET firstpost=(SELECT MIN(pid) FROM mybb_posts p WHERE t.tid=p.tid)
Why aren't they just using the raw original id?

convert\boards\vbulletin3\threads.php

$insert_data['firstpost'] = ((-1) * $data['firstpostid']);

---------------------

Your query worked! thanks!
ok now pay me USD $1000 (told you it was expensive Toungue )

nah just kidding have fun Smile
Pages: 1 2