[SOLVED] Search module re-index gives SQL error

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
User avatar
webform
Power Poster
Power Poster
Posts: 511
Joined: Sat Nov 25, 2006 3:39 pm

[SOLVED] Search module re-index gives SQL error

Post by webform »

When i try to reindex all content in Search module i get this SQL error:

Code: Select all

ERROR: 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 'WHERE active=1' at line 5
Cms Version: 1.11.12
phpversion: 5.4.37
Server Db Type: MySQL (mysql)
Server Db Version: 5.1.63

My local MAMP installation does not give this error! But it's also a newer version of PHP and MySQL:

phpversion 5.6.2
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.38

So is it my web host's PHP and MySQL versions the problem?
Last edited by webform on Thu Feb 12, 2015 4:08 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Search module re-index gives SQL error

Post by calguy1000 »

I checked. That code is not coming from anything in the CMS core.
It's probably a module.

You will have to do more digging, and isolate the problem to the specific module.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
webform
Power Poster
Power Poster
Posts: 511
Joined: Sat Nov 25, 2006 3:39 pm

Re: Search module re-index gives SQL error

Post by webform »

I've narrowed it down to the FAQ module!

Code: Select all

	function SearchReindex(&$module)
	{
		$db = cmsms()->GetDB();
		$query = "SELECT
								entry_id, question, answer
							FROM
								" . cms_db_prefix() . "module_gbook_entries,
							WHERE
								active=1";
		$result = $db->Execute($query);
		if ( $result && $result->RecordCount() > 0 )
		{
			while ( $row=$result->FetchRow() )
			{
				$module->AddWords($this->GetName(), $row['entry_id'], 'entry', $row['question'] . ' ' . $row['answer']);
			}
		}
		if ( !$result )
		{
			echo 'ERROR: ' . mysql_error();
			exit();
		}
	}
I've changed module_gbook_entries to module_faq_entries as it was wrong but it still gives an error!
User avatar
webform
Power Poster
Power Poster
Posts: 511
Joined: Sat Nov 25, 2006 3:39 pm

Re: Search module re-index gives SQL error

Post by webform »

It's solved now.

I've changed

Code: Select all

removed by moderator
It was a wrong call to table module_gbook_entries and stray comma making all the trouble.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: [SOLVED] Search module re-index gives SQL error

Post by paulbaker »

Sounds like this should be raised as a bug please?
http://dev.cmsmadesimple.org/projects/faq
click Bug Tracker tab.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
webform
Power Poster
Power Poster
Posts: 511
Joined: Sat Nov 25, 2006 3:39 pm

Re: [SOLVED] Search module re-index gives SQL error

Post by webform »

Yes! I've already filed a bug report in the forge.
Post Reply

Return to “The Lounge”