I wrote a custom module which updates one value in my content_type_d table. Code appears to work perfectly. The problem is that when I view the node afterward in the browser, the new value is NOT seen. Even though I confirm that the new value IS in MySQL, the old value appears on the page. The only way to get a new value to appear is to edit the node manually. The field type is integer text field.
I realize there is something that I am missing. Can someone clue me in?
Thanks.
It could be something as simple as the cache not being cleared. If you alter the database, you need to clear the cache for the correct value to be displayed.
http://api.drupal.org/?q=api/function/cache_clear_all/5
Joakim
On 6. sep. 2007, at 19.39, Fred Jones wrote:
I wrote a custom module which updates one value in my content_type_d table. Code appears to work perfectly. The problem is that when I view the node afterward in the browser, the new value is NOT seen. Even though I confirm that the new value IS in MySQL, the old value appears on the page. The only way to get a new value to appear is to edit the node manually. The field type is integer text field.
I realize there is something that I am missing. Can someone clue me in?
Thanks.
[ Drupal support list | http://lists.drupal.org/ ]
Joakim Stai wrote:
It could be something as simple as the cache not being cleared. If you alter the database, you need to clear the cache for the correct value to be displayed.
Great idea. But it doesn't seem to work. I tried now:
cache_clear_all();
cache_clear_all(NULL, 'cache_content');
cache_clear_all(NULL, 'cache');
and
cache_clear_all(NULL, 'cache_views');
but /node/18 remains the same--no update visible. :(
I don't think cache_filter nor cache_menu tables will do the trick either.
Any other ideas? It's Drupal 5.2.
Thanks.
Hi Fred. Could you post your code so that we can get a better handle on what you've done so far?
Thanks
On 9/6/07, Fred Jones fredthejonester@gmail.com wrote:
Joakim Stai wrote:
It could be something as simple as the cache not being cleared. If you alter the database, you need to clear the cache for the correct value to be displayed.
Great idea. But it doesn't seem to work. I tried now:
cache_clear_all(); cache_clear_all(NULL, 'cache_content'); cache_clear_all(NULL, 'cache');and
cache_clear_all(NULL, 'cache_views');but /node/18 remains the same--no update visible. :(
I don't think cache_filter nor cache_menu tables will do the trick either.
Any other ideas? It's Drupal 5.2.
Thanks.
[ Drupal support list | http://lists.drupal.org/ ]
William Smith wrote:
Hi Fred. Could you post your code so that we can get a better handle on what you've done so far?
Be forewarned that I know next to nothing about Drupal (yet) so any pointers are certainly appreciated. :)
IMO the necessity for the test "if (!isset($txn->items))" is due to a bug in the ecommerce module, but I haven't yet asked that list and anyhow that point is irrelevant to my main question. :)
Thanks!
Fred Jones a écrit :
cache_clear_all();
cache_clear_all(NULL, 'cache_content');
cache_clear_all(NULL, 'cache');
and
cache_clear_all(NULL, 'cache_views');
but /node/18 remains the same--no update visible. :(
I don't think cache_filter nor cache_menu tables will do the trick either.
Any other ideas? It's Drupal 5.2.
Thanks.
Great idea. But it doesn't seem to work. I tried now:
Definitely a question of the old value still being fetched from the cache_content table You want to call cache_clear_all('content:'. $node->nid, 'cache_content', TRUE) after modifying the db value.