从看门狗向表中插入值(insert values to a table from watchdog)

编程入门 行业动态 更新时间:2024-10-19 20:35:48
看门狗向表中插入值(insert values to a table from watchdog)

我有一个自定义模块,安装后会创建一个表格,其中包含blablabla名称和uid,时间戳为字段。 现在我真正想要的是当cron运行从监视程序表中获取值(uid,timestamp)并将其传递给我的blablabla表时。 有办法做这件事吗? 这是我的代码:

** * Implements hook_cron(). */ function example_cron() { // Begin building the query. $query = db_select('watchdog', 'th') ->extend('PagerDefault') ->orderBy('wid') ->fields('th', array('uid', 'timestamp')) ->limit(2000); // Fetch the result set. $result = $query -> execute(); }

I have a custom module which when installed it creates a table with blablabla name and uid,timestamp as fields. Now what i really want is when cron runs to get the values(uid, timestamp) from the watchdog table and pass it to my blablabla table. Is there a method to do this thing? This is my code:

** * Implements hook_cron(). */ function example_cron() { // Begin building the query. $query = db_select('watchdog', 'th') ->extend('PagerDefault') ->orderBy('wid') ->fields('th', array('uid', 'timestamp')) ->limit(2000); // Fetch the result set. $result = $query -> execute(); }

最满意答案

我做的 :

f($r->rowCount() == 0) { $query = db_insert('blablabla') ->fields(array( 'timestamp' => $timestamp, 'wid' => $wid, 'variables' => $variables, )) ->execute();

I did it :

f($r->rowCount() == 0) { $query = db_insert('blablabla') ->fields(array( 'timestamp' => $timestamp, 'wid' => $wid, 'variables' => $variables, )) ->execute();

更多推荐

本文发布于:2023-07-04 17:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026995.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:看门狗   insert   values   table   watchdog

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!