[support] Better a node_save or a db_query for a single field ?
Michel Morelli
michel at ziobuddalabs.it
Wed Apr 7 09:42:13 UTC 2010
Hi all. I have a content type with a cck integer field and I need to
increment it when user click on a link (user is redirect to another
page, or similar).
To do this I have two option:
1) node_save
2) db_query
This node type has a total of 5 cck fields. Other fields does not change
when user click on that link.
My site would be a trafficated site so I could have 10 or 100 clicks on
that link in a single moment.
I think to this code (for sql query solution):
db_query("LOCK TABLES {content_type_gf_product} WRITE,{watchdog} WRITE");
db_query("UPDATE {content_type_my_type} set field_download_stats_value
= field_download_stats_value+1 where nid = %d and vid = %d",
$node->nid,$node->vid);
db_query("UNLOCK TABLES");
Tnx.
--
Michel 'ZioBudda' Morelli michel at ziobuddalabs.it
Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 -- Fax: +39-0291390660
http://www.ziobudda.net ICQ: 58351764
http://www.ziobuddalabs.it Skype: zio_budda
http://www.ziodrupal.net MSN: michel at ziobuddalabs.it
JABBER: michel at ziobuddalabs.it
More information about the support
mailing list