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."
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 troubleshooting → 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."
turn on debug mode and tell us what it says
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
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.
What is "vanilla" version?
"Plain" as in "unmodded", straight from the download
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
Anybody who can help? The file is here: http://www.punres.org/viewtopic.php?pid=1955#p1955
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
Thank you, Smartys! Now, it works
PunBB Forums → PunBB 1.2 troubleshooting → Problem with 'show results as posts' in search
Powered by PunBB, supported by Informer Technologies, Inc.