phpMyFAQ icon indicating copy to clipboard operation
phpMyFAQ copied to clipboard

Issues with MS SQL Queries

Open Grunticus03 opened this issue 3 years ago • 4 comments

Describe the bug Many SQL query issues on many different pages.

Configuration phpMyFAQ on Windows Server 2019 using IIS and PHP 8.1 SQL Standard 2019 on Windows Server 2019 Standard No Elasticsearch

42000: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Column "faqcategory_order.position" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
42000: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Column 'faqdata.thema' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

Grunticus03 avatar May 30 '22 04:05 Grunticus03

I've discovered the functions and, after going through every link, found another related to Attachment management. The first one appears to be related to how categories are ordered and I can confirm that they are not ordered by name anymore. Otherwise, I'm unsure of what impact making the other changes makes.

src/phpMyFAQ/Category.php line 256: Remove fco.position

src/phpMyFAQ/faq.php line 2393: Add thema

(New) src/phpMyFAQ/Attachment/AttachmentCollection.php line 73: Add record_id,record_lang,filename,filesize,mime_type

Grunticus03 avatar May 30 '22 06:05 Grunticus03

Unsure if this is related or not, but after going into a category's properties and unchecking Show on startpage, I get the below fatal error. However, the change is successfully made.

phpMyFAQ Fatal error
Uncaught exception: 'TypeError'

Message: 'phpMyFAQ\Category::updateCategory(): Return value must be of type bool, resource returned'

Stack trace:

#0 D:\phpmyfaq\admin\category.main.php(228): phpMyFAQ\Category->updateCategory()
#1 D:\phpmyfaq\admin\index.php(404): require('...')
#2 {main}
Thrown in 'D:\phpmyfaq\src\phpMyFAQ\Category.php' on line 1144

Grunticus03 avatar May 30 '22 06:05 Grunticus03

Changing

src/phpMyFAQ/Category.php line 256: Remove fco.position

will break the sorting for categories.

thorsten avatar May 30 '22 18:05 thorsten

@wwalker0307 do you have another idea how to fix this?

thorsten avatar Jul 09 '22 11:07 thorsten

I was able to fix part of the category issues with this.

src/phpMyFAQ/Category.php line 253: Add fco.position (instead of removing it from the Order By)

It enabled me to see categories again in the admin panel (which was one of the issues).

TheArchitectIO avatar Nov 08 '22 15:11 TheArchitectIO

@TheArchitectIO awesome, would you like to add a PR for this?

thorsten avatar Nov 08 '22 15:11 thorsten

@thorsten I sure can.

TheArchitectIO avatar Nov 08 '22 15:11 TheArchitectIO

Awesome!

thorsten avatar Nov 08 '22 15:11 thorsten