Rankings and Top 10 not working
Moderator: Thorsten
Rankings and Top 10 not working
Hello,
First I want to say this is really a wonderful program. I am using version 1.6.3 and am running PHP 5.1.4 on a Windows Server 2003 box with a Microsoft SQL Server 2005 backend. Everything is working fine except the article rankings on the admin page and the top 10/ top 5 on the start page. After examining stat.ratings.php, I decided to try the query in the SQL Sever Management Studio. When I run the ratings query I get the following error message: "The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator". I'm assuming a similar problem is occurring with the queries for the Top 10 and Top 5. I never receive an error in the web browser though, just no results.
Can anyone help?
Thanks!
First I want to say this is really a wonderful program. I am using version 1.6.3 and am running PHP 5.1.4 on a Windows Server 2003 box with a Microsoft SQL Server 2005 backend. Everything is working fine except the article rankings on the admin page and the top 10/ top 5 on the start page. After examining stat.ratings.php, I decided to try the query in the SQL Sever Management Studio. When I run the ratings query I get the following error message: "The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator". I'm assuming a similar problem is occurring with the queries for the Top 10 and Top 5. I never receive an error in the web browser though, just no results.
Can anyone help?
Thanks!
Hi,
it seems MS SQL Server 2005 does not like this query. I'll work on that problem.
Regards
Thorsten
it seems MS SQL Server 2005 does not like this query. I'll work on that problem.
Regards
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Thanks for the quick reply. I also tried the Top 10 query from functions.php in the Query Analyzer and got this error message: "The text data type cannot be selected as DISTINCT because it is not comparable". I also noticed that in functions.php this query has a WHERE statement on the end of it with no arguments.
Hi,
could you try the queries without DISTINCT?
bye
Thorsten
could you try the queries without DISTINCT?
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Without DISTINCT the query will run in the analyzer, but returns too many duplicates (i.e. 10 results for each article with each having a different number of visits). When I took DISTINCT out of the query in functions.php, the top 10 still shows no data on the faq startpage.
With a simplified query like this I seem to get the desired results (haven't tried modifying functions.php with this yet):
use faq
SELECT faqdata.id, faqcategoryrelations.*, faqdata.thema, faqvisits.visits
FROM faqdata, faqcategoryrelations, faqvisits
WHERE faqdata.id = faqcategoryrelations.record_id
AND faqvisits.id = faqcategoryrelations.record_id
With a simplified query like this I seem to get the desired results (haven't tried modifying functions.php with this yet):
use faq
SELECT faqdata.id, faqcategoryrelations.*, faqdata.thema, faqvisits.visits
FROM faqdata, faqcategoryrelations, faqvisits
WHERE faqdata.id = faqcategoryrelations.record_id
AND faqvisits.id = faqcategoryrelations.record_id
I was running the query from functions.php incorrectly before. I missed the part after the function checks for a set category and language. That takes care of providing distinct records. However, I added a line that would print the query before it executes and on the startpage the query string is the query twice. No results are generated in the Top 10 Message box. I'm looking at the script and I see no reason for this to be happening. When I view a specific category, the query is generated correctly but still no Top 10 results.
text -> (n)varchar
Hi,
it seems we need to use 'varchar' ['varchar' (max 8000 chars) or 'nvarchar' (max 4000 chars)] instead of 'text' for those fields that you've removed for successfully running the query.
You could try this fix even if we need to verifiy if that could be the right solution. You could test it e.g. (I do not test the SQL code below):
Matteo
it seems we need to use 'varchar' ['varchar' (max 8000 chars) or 'nvarchar' (max 4000 chars)] instead of 'text' for those fields that you've removed for successfully running the query.
You could try this fix even if we need to verifiy if that could be the right solution. You could test it e.g. (I do not test the SQL code below):
Code: Select all
ALTER TABLE 'faqdata' RENAME 'faqdata_163'Code: Select all
SELECT * INTO faqdata FROM faqdata_163Code: Select all
RENAME COLUMN faqdata.thema TO thema_oldCode: Select all
ALTER TABLE faqdata ADD thema VARCHAR AFTER thema_oldCode: Select all
UPDATE faqdata SET thema = thema_old
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist
Hi,
this bug is fixed in phpMyFAQ 1.6.4 and 2.0.0-dev. We removed the DISTINCT part which causes the problems.
bye
Thorsten
this bug is fixed in phpMyFAQ 1.6.4 and 2.0.0-dev. We removed the DISTINCT part which causes the problems.
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist