Topic: Problem with 'show results as posts' in search

When I choose that option on my forym I got an error message:  "Error: Unable to fetch search results."

Re: Problem with 'show results as posts' in search

turn on debug mode and tell us what it says

3 (edited by Edward 2005-07-09 07:31)

Re: Problem with 'show results as posts' in search

It says:

File: /home/bulgaricus/public_html/forum/search.php
Line: 477

PunBB reported: Unable to fetch search results

Database reported: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '.last_post, t.last_post_id, t.last_poster, t.num_replies, t.for (Errno: 1064)

I have to add that my search.php file was changed recently according to Easy Poll 1.1.2.

My changed search.php file can be seen here: http://www.punres.org/viewtopic.php?pid=1955#p1955

Re: Problem with 'show results as posts' in search

Try replacing it with a "vanilla" 1.2.6 version and see if that helps. If it does, you know it's a problem with your search.php.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Problem with 'show results as posts' in search

What is "vanilla" version?

Re: Problem with 'show results as posts' in search

"Plain" as in "unmodded", straight from the download

Re: Problem with 'show results as posts' in search

I replaced the file with the vanilla version from 1.2.6 and the search worked. So, the problem is in my search.php file sad

Anybody who can help? The file is here: http://www.punres.org/viewtopic.php?pid=1955#p1955

Re: Problem with 'show results as posts' in search

FIND

$sql = 'SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, '.$substr_sql.'(p.message, 1, 1000) AS message, t.id AS tid, t.poster, t.subject, t.question t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id IN('.$search_results.') ORDER BY '.$sort_by_sql;

REPLACE WITH

$sql = 'SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, '.$substr_sql.'(p.message, 1, 1000) AS message, t.id AS tid, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id IN('.$search_results.') ORDER BY '.$sort_by_sql;

t.question didn't have a comma after it

Re: Problem with 'show results as posts' in search

Thank you, Smartys! Now, it works smile