![]() |
What is wrong with this plugin query?
Code:
$db->query_write("UPDATE " . TABLE_PREFIX . "thread SET open = 0 WHERE threadid = '$threadid' AND votetotal/votenum <= '5'"); If I change it to: Code:
$db->query_write("UPDATE " . TABLE_PREFIX . "thread SET open = 0 WHERE threadid = '$threadid' AND votetotal <= '5'"); |
Because votetotal/votenum is invalid sql?
|
@merk
Works just fine for me ... |
Strange.
May have been a chance in the way MySQL deals with certain syntax then? What version of MySQL flypaper / Kirby? |
Quote:
edit: And I think I'm using 4.0.25 |
Well, depends where you run that as a Plugin (eg. which Hook).
I am using an outdated mySQL 4.1.12, but I think that doesn't matter much. |
oops. Im using 4.1.12 also.
And the hook is threadrate_add. |
It think the following does happen:
1) The Threadrate Datamager gets the $threadinfo array (which contains open=1) 2) You issue the Query to close the Thread 2) save() is called on the Threadrate Datamanager, After saving, the Datamanager instantiates a Thread Datamanager to update votetotal/votenum using $threadinfo that has passed earlier (containing open=1) Then it writes this to the Database - undoing what your query did. Does that make sense? I'd hook into threaddata_presave and check the rating there, if it's below your limit set open=0. This should work, without any Query overhead. |
What is the error message? A bit hard to determin the problem without knowing why it "doesnt work".
|
Quote:
Would that explain the 2nd query I gave in the original post working tho? btw, I will test this tonite for sure... |
All times are GMT. The time now is 05:19 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|