我看了穆迪的data manipulation API,发现可以通过$DB->insert_records
插入值并通过$DB->get_records_sql
选择,但在我的情况下,我有一个名为{{1 }}:
block_userlist
我想从+------------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------+------+-----+---------+----------------+
| id | bigint(10) | NO | PRI | NULL | auto_increment |
| user_id | bigint(10) | NO | | NULL | |
| logout_time | bigint(10) | YES | | NULL | |
| login_time | bigint(10) | NO | | NULL | |
| session_duration | bigint(10) | YES | | NULL | |
+------------------+------------+------+-----+---------+----------------+
的以下字段中填充它:
user
喜欢:
+------------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------+------+-----+---------+----------------+
| id | bigint(10) | NO | PRI | NULL | auto_increment |
| currentlogin | bigint(10) | NO | | 0 | |
| lastaccess | bigint(10) | NO | MUL | 0 | |
+------------------+------------+------+-----+---------+----------------+
因此,我可以通过php利用block_userlist.user_id <= user.id
block_userlist.login_time <= user.currentlogin
block_userlist.logout_time <= user.lastaccess
block_userlist.session_duration <= user.lastaccess - user.currentlogin
来检索结果,并通过$DB->get_records_sql
插入它们,但这将导致网站和数据库之间的往返,而许多DBMS可以将值从一个插入到一个表中。如果我有mySQL,可以选择另一个查询,例如:
$DB->insert_records
因此我想问: