<small id='Khs2N'></small><noframes id='Khs2N'>

    • <bdo id='Khs2N'></bdo><ul id='Khs2N'></ul>

      <legend id='Khs2N'><style id='Khs2N'><dir id='Khs2N'><q id='Khs2N'></q></dir></style></legend>

    1. <i id='Khs2N'><tr id='Khs2N'><dt id='Khs2N'><q id='Khs2N'><span id='Khs2N'><b id='Khs2N'><form id='Khs2N'><ins id='Khs2N'></ins><ul id='Khs2N'></ul><sub id='Khs2N'></sub></form><legend id='Khs2N'></legend><bdo id='Khs2N'><pre id='Khs2N'><center id='Khs2N'></center></pre></bdo></b><th id='Khs2N'></th></span></q></dt></tr></i><div id='Khs2N'><tfoot id='Khs2N'></tfoot><dl id='Khs2N'><fieldset id='Khs2N'></fieldset></dl></div>
    2. <tfoot id='Khs2N'></tfoot>

      1. CodeIgniter 查询:如何将列值移动到同一行中的另一列并将当前时间保存在原始列中?

        CodeIgniter query: How to move a column value to another column in the same row and save the current time in the original column?(CodeIgniter 查询:如何将列值移动到同一行中的另一列并将当前时间保存在原始列中?) - IT屋-程序员软件开发技术分享社
        <legend id='DVrZ8'><style id='DVrZ8'><dir id='DVrZ8'><q id='DVrZ8'></q></dir></style></legend>
      2. <i id='DVrZ8'><tr id='DVrZ8'><dt id='DVrZ8'><q id='DVrZ8'><span id='DVrZ8'><b id='DVrZ8'><form id='DVrZ8'><ins id='DVrZ8'></ins><ul id='DVrZ8'></ul><sub id='DVrZ8'></sub></form><legend id='DVrZ8'></legend><bdo id='DVrZ8'><pre id='DVrZ8'><center id='DVrZ8'></center></pre></bdo></b><th id='DVrZ8'></th></span></q></dt></tr></i><div id='DVrZ8'><tfoot id='DVrZ8'></tfoot><dl id='DVrZ8'><fieldset id='DVrZ8'></fieldset></dl></div>
          <tbody id='DVrZ8'></tbody>
        <tfoot id='DVrZ8'></tfoot>
          • <bdo id='DVrZ8'></bdo><ul id='DVrZ8'></ul>

                  <small id='DVrZ8'></small><noframes id='DVrZ8'>

                • 本文介绍了CodeIgniter 查询:如何将列值移动到同一行中的另一列并将当前时间保存在原始列中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的 db 表中,我有两个日期时间列:LastCurrent.这些列允许我跟踪某人上次使用有效登录名登录我正在构建的服务的时间.

                  In my db table, I have two datetime columns: Last and Current. These column allow me to keep track of when someone last used a valid login to the service I am building up.

                  使用 CodeIgniter 的活动记录,是否可以更新一行,以便 Last 值接收 Current 值,然后是 Current 值是否替换为当前日期时间?

                  Using CodeIgniter's active record, is it possible to update a row so that the Last value receives the Current value AND then the Current value is replace with the current datetime?

                  推荐答案

                  试试这样:

                  $data = array('current_login' => date('Y-m-d H:i:s'));
                  $this->db->set('last_login', 'current_login', false);
                  $this->db->where('id', 'some_id');
                  $this->db->update('login_table', $data);
                  

                  特别注意 set() 调用的第三个参数.false 防止 CodeIgniter 引用第二个参数——这允许将值视为表列而不是字符串值.对于不需要特殊处理的任何数据,您可以将所有这些声明集中到 $data 数组中.

                  Pay particular attention to the set() call's 3rd parameter. false prevents CodeIgniter from quoting the 2nd parameter -- this allows the value to be treated as a table column and not a string value. For any data that doesn't need to special treatment, you can lump all of those declarations into the $data array.

                  以上代码生成的查询:

                  UPDATE `login_table`
                  SET last_login = current_login, `current_login` = '2018-01-18 15:24:13'
                  WHERE `id` = 'some_id'
                  

                  这篇关于CodeIgniter 查询:如何将列值移动到同一行中的另一列并将当前时间保存在原始列中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <legend id='XkqXz'><style id='XkqXz'><dir id='XkqXz'><q id='XkqXz'></q></dir></style></legend>
                            <tbody id='XkqXz'></tbody>

                          <tfoot id='XkqXz'></tfoot>

                          <i id='XkqXz'><tr id='XkqXz'><dt id='XkqXz'><q id='XkqXz'><span id='XkqXz'><b id='XkqXz'><form id='XkqXz'><ins id='XkqXz'></ins><ul id='XkqXz'></ul><sub id='XkqXz'></sub></form><legend id='XkqXz'></legend><bdo id='XkqXz'><pre id='XkqXz'><center id='XkqXz'></center></pre></bdo></b><th id='XkqXz'></th></span></q></dt></tr></i><div id='XkqXz'><tfoot id='XkqXz'></tfoot><dl id='XkqXz'><fieldset id='XkqXz'></fieldset></dl></div>

                          <small id='XkqXz'></small><noframes id='XkqXz'>

                            <bdo id='XkqXz'></bdo><ul id='XkqXz'></ul>