We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Forum plugin search function gives error message | Forum

Bob Newbie
Bob Newbie Oct 18 '19

Just a little background.  I can use the search function when viewing  the photos, Blogs and members plugins and they work just fine. If I do a  forum search, I get the Error 500 message.  I have went through possibilities listed in the Error 500 sticky topic at the top of the forum and I can't find a solution to my problem.


No modifications have been made to the Oxwall software. The same error occurs no matter which theme I select. I've found no other problems when using my Oxwall site.  The php version is 5.5.


This isn't a problem unique to my website. I have found other Oxwall websites that have the same problem. Here is an example where you can test it by doing a search in their forum.


Below is the error message I get when in debug mode. Any help would be appreciated.


 OW Debug - exception ----------------------------------------------------------------------------

Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rows' at line 23 File: /home/kathyt7/public_html/rcmem/ow_core/database.php Line: 723 Trace: #0 /home/kathyt7/public_html/rcmem/ow_core/database.php(723): PDOStatement->execute() #1 /home/kathyt7/public_html/rcmem/ow_core/database.php(385): OW_Database->execute('\n SE...', Array) #2 /home/kathyt7/public_html/rcmem/ow_system_plugins/base/bol/search_entity_dao.php(387): OW_Database->queryForRow('\n SE...', Array) #3 /home/kathyt7/public_html/rcmem/ow_system_plugins/base/classes/mysql_search_storage.php(277): BOL_SearchEntityDao->findEntitiesCountByText('joker', Array, 0, 0) #4 /home/kathyt7/public_html/rcmem/ow_core/text_search_manager.php(303): BASE_CLASS_MysqlSearchStorage->searchEntitiesCount('joker', Array, 0, 0) #5 /home/kathyt7/public_html/rcmem/ow_plugins/forum/bol/text_search_service.php(285): OW_TextSearchManager->searchEntitiesCount('joker', Array) #6 /home/kathyt7/public_html/rcmem/ow_plugins/forum/bol/forum_service.php(1924): FORUM_BOL_TextSearchService->countGlobalTopics('joker', NULL) #7 /home/kathyt7/public_html/rcmem/ow_plugins/forum/controllers/search.php(472): FORUM_BOL_ForumService->countGlobalTopics('joker', NULL) #8 /home/kathyt7/public_html/rcmem/ow_plugins/forum/controllers/search.php(66): FORUM_CTRL_Search->searchEntities(Array, 'global') #9 [internal function]: FORUM_CTRL_Search->inForums(Array) #10 /home/kathyt7/public_html/rcmem/ow_core/request_handler.php(250): ReflectionMethod->invokeArgs(Object(FORUM_CTRL_Search), Array) #11 /home/kathyt7/public_html/rcmem/ow_core/request_handler.php(226): OW_RequestHandler->processControllerAction(Object(ReflectionMethod), Object(FORUM_CTRL_Search)) #12 /home/kathyt7/public_html/rcmem/ow_core/application.php(346): OW_RequestHandler->dispatch() #13 /home/kathyt7/public_html/rcmem/index.php(76): OW_Application->handleRequest() #14 {main} Type: PDOException

Paul
Paul Oct 18 '19
You are using mariaDB, right?
Just fix this and quote rows:


https://github.com/...8073ca89b0897f77a3ea

Bob Newbie
Bob Newbie Oct 19 '19
Thanks for your reply. No, my database is MySQL as far as I know. My cPanel shows it as a MySQL database. Is there a way I can tell for certain?. I see in the error message that it says I have a mariaDB.  Is there an Oxwall setting that I need to change to set the database to MySQL? You help is appreciated.
Patricia Zorrilla Leader
Patricia Zorrilla Oct 19 '19

Apply Paul's solution because it is compatible with MySQL !!!!

The low-cost servers among them "pass" tasks and there is no way to know where your tables are or how they are managed, so it is best that the PHP code is very clear and explicit in SQL queries.

We must find that it is compatible with all managers at all costs. Especially if you do not have your own server managed by you.

You don't care about adding those quotes and trying again.

Keep us informed! 

Bob Newbie
Bob Newbie Oct 19 '19

I tried several times using the quote " character and the result was a white screen.  When I figured out that I had to use the back quote ` character the search function worked perfectly.  (see attached)

Thank you both for your help. It is very much appreciated! 





The Forum post is edited by Bob Newbie Oct 19 '19
Patricia Zorrilla Leader
Patricia Zorrilla Oct 19 '19

There are three types of quotes, I call them left, single and double.

If you "open" with one type you have to "close" with the other or secure blank screen.

And if within one type you open and close another there is a range of priorities, if you respect the order <double> <single> <left> " ' ` whatever ` ' " <left> <single> <double> you will not have problems but if you do not do so you will have unexpected results.

In this case, the truth is that the OxWall SQL expression is incorrect, but MySQL tries to "quote" what it does not understand before giving an error and MariaDB - which is more coarse - makes an error directly.

This I have found out experimentally ... when I studied computer a floppy disk of a few Kb measured what a pizza and we did not have so many letters.


The Forum post is edited by Patricia Zorrilla Oct 19 '19
Bob Newbie
Bob Newbie Oct 19 '19

"There are three types of quotes, I call them left, single and double."


Thanks for the information on the different type of quotes. This was the first time I've needed to use the left quotes. I have some training in computer programming but I'm not a programmer by profession. I am able to edit scrips that others have written.  I'm lost when it comes to databases. Without the help I received on this forum I would have never been able to figure out this problem. Thanks again.


"when I studied computer a floppy disk of a few Kb measured what a pizza and we did not have so many letters."


The first programming I did was in BASIC on a Commodore Vic-20 computer that had 5k of memory. It stored programs on a cassette tape. :)

Glor
Glor Aug 3 '20
I’m having the same issue and the search in my community forum is essential to the growth of my website. However I’m not a developer or guru but I can work with a manual. Please, how do I go about editing this quote? 


Any help or hit will be appreciated. 

dave Leader
dave Aug 3 '20

Just FYI the left quote Patricia is referring to is called a tilde (pronounced til-dee), its only really ever used IMO in sql commands for database transactions.  On common keyboards its located on the left side of the #1 key on the top of the keyboard. 


This is a tilde `  used almost exclusively IMO in MySql Sql commands structure


This is a single quote '      can be used for text or integer (but the server will convert it to integer if its numeric.  Basically its used as a delimeter and also to indicate literal meaning(it is what it is sort of thing) (it is recommended never use single quotes around  integer values)


This is a double quote "    pretty much used for text only IMO


There are times that its possible to confuse tilde's for single quotes if you dont look closely and pay attention.



Glor....  You can still do the change regardless if you have mariaDB or not.  Adding tilde's is not going to hurt anything.  Look at that link above from paul.  Look at the red and the green bars, the red bar is the old code (with out tilde's)  the green bar is the changed code (with tilde's) 


For example the first one...


it shows  as rows

change it to  as `rows`   (remember its a tilde NOT a single quote)  leave everything else the same including the single quote after it.


The red and green will show you the difference, its up to you to decide what has changed exactly and repeat it. 


Always use notepad or a actual code editor when editing code files (never open them with a text editor)


DO NOT EVER copy any code from the net (regardless how simple it is) and post it directly into your code file. Always post it into notepad or a code editor first.  There may be hidden values and putting them into a notepad or code editor first will remove those.  Then copy it from the notepad into your file.. Or just manually type the code.


Hope that helps you all...   :)





The Forum post is edited by dave Aug 3 '20
Glor
Glor Aug 3 '20
Thanks so much Dave.
dave Leader
dave Aug 3 '20
You are very welcome :)