I have tested update forum counts on the same db in mysql4 and mysql5.0.4 mysql4 no problem mysql5 error
changing tables as sad before no errors in mysql 5
Sometimes mysql5 give error in SELECT COUNT AS (variable) function so the count varible as to be cLng(variable) anywhere, but it affects only some occourrences and I don't know why in some lines it give a correct value and in someothers I get error.
Ok so you tried the database table changes posted by tsnyder91 and it fixed the problems in MySQL 5? Did you try the database table changes with MySQL 4? See if the changes worked ok with it?
You also saying you getting errors in SELECT COUNT AS (variable) queries even with the changes suggested by tsnyder91?
I get select count errors somewhere in code, as in forum stats mod (it uses its table of course) I don't know now where such a function is called using that tables.. no errors in counting topics and reply in default and forum (but that isn't a select count function) but I get a 0 value always in these function:
if strDBType = "access" then strSqL = "SELECT count(M_TO) as [pmcount] " else strSqL = "SELECT count(M_TO) as pmcount " end if strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS , " & strTablePrefix & "PM " strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.M_NAME = '" & strDBNTUserName & "'" strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "PM.M_TO " strSql = strSql & " AND " & strTablePrefix & "PM.M_READ = 0 " Set rsPM = my_Conn.Execute(strSql) pmcount = rsPM("pmcount") rsPM.Close
to get private mess
if you can suggest where I have to look, I will look.
Testing these problems against the latest version of the MyODBC driver version 3.5.22, it seems to have fixed the problem as was previously stated.
But with that, there was some minor Type Mismatch errors that showed up on step 4. Lines 407 and 427 complained of Type Mismatch.
Line 407: intF_COUNT = rs1("cnt") + rs1("SumOfT_REPLIES")
Line 427: intF_A_COUNT = rs1("cnt") + rs1("SumOfT_REPLIES")
Added the CLng() functions to them and the Type Mismatch went away.
But now, the rs1("SumOfT_REPLIES") was returning a null value which CLng() function doesn't like. The SUM() function will return a null value if no results where found. Unlike the COUNT() function will return a 0.
if IsNull(rs1("SumOfT_REPLIES")) then
intF_COUNT = rs1("cnt")
else
intF_COUNT = CLng(rs1("cnt")) + CLng(rs1("SumOfT_REPLIES"))
end if
intF_TOPICS = rs1("cnt")
if IsNull(rs1("SumOfT_REPLIES")) then
intF_A_COUNT = rs1("cnt")
else
intF_A_COUNT = CLng(rs1("cnt")) + CLng(rs1("SumOfT_REPLIES")
end if
intF_A_TOPICS = rs1("cnt")
I know many web hosts might not be running the latest MyODBC drivers, so changing the database fields to use DOUBLE type can be done to fix those cases.