从看门狗向表中插入值(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();更多推荐
发布评论