Update query increment field plus 1 codeigniter

how would I go about updating that field by 1 within a sql command?
Ankur Rajput
Asked 16-11-2019
63

Answer (1)
$this->db->where("id", $id);
$this->db->set("set_row", "`set_row`+ 1", FALSE);
$this->db->update("article");</pre>
                                    </div>

                                </div>
                            </div>
                            <div class="col-md-2 com-by">
                                <div><img src="https://myinboxhub.co.in/data/avtar.png" style=""></div>
                                <div>Deepak Sharma</div>
                                <div>Asked  18-07-2018</div>
                                <div>45 Likes</div>
                            </div>
                            <div class="col-md-10">
                                <div class="ans-count"> <i class="	glyphicon glyphicon-comment"></i>	Comments</div>
                            </div>
                                                        <!-- submit comment--->
                            <div class="col-md-10" style="">
                                <div class="submit-comment" onclick="showEditor(28)">Write comment</div>				
                                <div style="display:none" id="div28">
                                    <div class="" id="comAlert28" style="display:none"></div>
                                    <textarea type="text" name="comment28"  id="comment28" class="form-control textarea" placeholder="Write your comment..."></textarea>
                                    <span class="btn btn-submit" onclick="submitComment($('#comment28').val(),28)">Submit</span>
                                </div>
                                <br/>
                            </div>
                        </div>
                                    </div>
            <!-- submit answer--->
            <div class="col-md-10" style="">
                <div class="submit-answer">Submit your answer</div>				
                <div>
                    <form action="https://myinboxhub.co.in/submituseranswer" method="post" onsubmit="return validateAns()">
                        <input type="hidden" name="ques" value="24">
                        <textarea type="text" name="answer"  id="editor1" class="form-control textarea" onclick="" placeholder="Write your answer..." style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
                        <input type="submit" value="Submit" class="btn btn-submit">
                        </div>
                        <br/>
                </div>

                	
        </div>
        <div class="col-md-2 adsbygoogle" id="">
            <!-- inbox_blog -->
            <ins class="adsbygoogle"
                 style="display:block"
                 data-ad-client="ca-pub-8512817866931930"
                 data-ad-slot="6739489089"
                 data-ad-format="auto"
                 data-full-width-responsive="true">

            </ins>
            <script>
                (adsbygoogle = window.adsbygoogle || []).push({});
            </script>
        </div>
    </div>
    <script>
        function showEditor(ansId) {
            $('#div' + ansId).show();
        }
        function submitComment(ansId, id) {
            var comment = ansId.trim();
            if (comment) {
                $.ajax({
                    type: "POST",
                    url: 'https://myinboxhub.co.in/submitcomment',
                    dataType: 'json',
                    data: {"ansId": id, "comment": comment},
                    success: function (result) {
                        if (result.Success == 'TRUE') {
                            alert(result.Message);
                        } else {
                            alert(result.Message);
                            location.href = result.Result;
                        }
                    }
                });
            } else {
                $('#comAlert' + id).addClass('alert');
                //	document.getElementById('comAlert'+id).style.textAlign='left';
                $('#comAlert' + id).html('<i class="glyphicon glyphicon-alert"></i> Write your comment first!');
                $('#comment' + id).focus();
                setTimeout(function () {
                    $('#comAlert' + id).removeClass('alert');
                }, 5000);
            }
        }
    </script>
    <script>
        function validateAns() {
            var editorText = CKEDITOR.instances.editor1.getData();
            if (editorText.trim() == '') {
                var msg = 'Write your answer first!';
                notificationAlert(msg);
                return false;
            }
        }
    </script>


    <script>
        //exec in last
        $(document).ready(function () {
            incrview();
        });
        function incrview() {
            var qid = '24';
            if (qid) {
                $.ajax({
                    type: "POST",
                    url: 'https://myinboxhub.co.in/home/incrqueview',
                    dataType: 'json',
                    data: {"queId": qid},
                    success: function (result) {
                        if (result.Success == 'TRUE') {
                            console.log('done');
                        } else {
                        }
                    }
                });
            }
        }
    </script>
    <script>/* 
     $( document ).ready(function() {
     getAds();
     });
     function getAds(){
     var qid='24';
     if(qid){
     $.ajax({
     type: "POST",
     url: 'https://myinboxhub.co.in/home/getAds',
     dataType: 'json',
     data: {"limit":10},
     success: function(result){
     if(result.Success == 'TRUE'){
     for(var i=0; i<result.Result.length; i++){
     if($('#getgoogleads')){
     //	document.getElementById('getgoogleads').innerHTML=result.Result[i]['ad_content'];
     $("#getgoogleads").append(result.Result[i]['ad_content']+'<div>&nbsp;</div>');
     }else{
     $(".adsbygoogle").append(result.Result[i]['ad_content']+'<div>&nbsp;</div>');
     }
     }
     }else{					
     }
     }
     });
     }
     } */
    </script>
    <script src="https://cdn.ckeditor.com/4.5.10/standard/ckeditor.js"></script>

    <script type="text/javascript">
         $(function () {
             CKEDITOR.replace('editor1');
             //   CKEDITOR.replace('editor2');
         });
    </script><style>
    .my-footer{
        z-index:10;
    }
    .list-group a:hover{
        color:#000;
        opacity:.7;
    }

    .list-group-item {
        background-color: unset;
        border: unset; transition:1s;
        border-bottom: 1px solid transparent; padding: 5px 10px;
    }
    .my-footer ul li a{
        color:#fff !important;font-size: 14px;
    }
    a:hover{
        color:#000 !important; text-decoration:underline;
    }
    .answer-text a:hover{color:#668ebe!important;}
    .social-icon i {
        color:#fff!important;
    }
</style>
<footer>
    <div class="col-md-12 my-footer">
        <div class="container">
            <div class="col-md-4">
                <div class="heading">Company</div>		
                <div class="bottom-border-white"></div>
                <ul>
                    <li><a href="#">About Us</a></li>
                    <li><a href="#">Contact Us</a></li>
                    <li><a href="https://myinboxhub.co.in/blogs">Blogs</a></li>
                    <li><a href="https://myinboxhub.co.in/account/login">LogIn</a></li>
                    <li><a href="https://myinboxhub.co.in/account/signup">SignUp</a></li>
                    <li><a href="#">Site Map</a></li>
                </ul>
                <div class="heading">Donate</div>		
                <div class="bottom-border-white"></div>
                <ul>
                    <li><a href="https://www.paypal.me/YogendraTomar123"><i class="fa fa-paypal" aria-hidden="true" style="color:#0070ba!important"></i> PayPal</a></li> 
                </ul>
            </div>
            <div class="col-md-4">
                <div class="heading">Categories</div>		
                <div class="bottom-border-white"></div>
                <ul class="category">
                                                <li><a href="https://myinboxhub.co.in/category/Application">Application</a></li> 
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Artificial-Intelligence">Artificial Intelligence</a></li> 
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Database">Database</a></li> 
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Digital-Marketing">Digital Marketing</a></li> 
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/physiotherapy">Physiotherapy</a></li> 
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Web-Technology">Web Technology</a></li> 
                                                                                            </ul>
            </div>
            <div class="col-md-4">
                <div class="heading">Subjects</div>		
                <div class="bottom-border-white"></div>
                <ul class="category">
                                                <li><a href="https://myinboxhub.co.in/category/analytics">Analytics</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/anatomy">Anatomy</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Android">Android</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/AngularJS">AngularJS</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Artificial-Intelligence">Artificial Intelligence</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/AWS">AWS</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/biomechanics">Biomechanics</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/Bootstrap">Bootstrap</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/cakephp">Cakephp</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/CodeIgniter">CodeIgniter</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/CSS">CSS</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/electrotherapy">Electrotherapy</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/exercise-therapy">Exercise therapy</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/htaccess">Htaccess</a></li>
                                                            <li> | </li>
                                                                                    <li><a href="https://myinboxhub.co.in/category/HTML">HTML</a></li>
                                                                                            </ul>				
                <div class="heading">Social Links</div>		
                <div class="bottom-border-white"></div>

                <span itemscope itemtype="http://schema.org/Organization">
                    <link itemprop="url" href="https://myinboxhub.co.in/">
                    <ul class="social-icon category">
                        <li><a  href="https://www.facebook.com/programminglanguages000/" rel="follow" target="_blank" itemprop="sameAs" title="facebook" class=""><i class="fa fa-facebook"></i></a></li>
                        <li><a href="" rel="follow" target="_blank" itemprop="sameAs" class="" title="twitter"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="" rel="follow" target="_blank" itemprop="sameAs" title="googleplus"><i class="fa fa-google-plus"></i></a></li>
                        <!--li><a href="https://www.youtube.com/channel/UCXODjxyN408dUUheWC9g6kA" rel="follow" target="_blank" itemprop="sameAs" title="googleplus"><i class="fa fa-youtube"></i></a></li-->

                    </ul>
                </span>
            </div>
        </div>

    </div>

    <div class="col-md-12 text-center" style="background: #000;padding:10px; color:#fff;z-index:10;">
        Privacy Policy © 2019 MyinboxHub. All rights Reserved | Design & Developed by MyinboxHub Team
    </div>
</div>
</footer>


<script>
    setInterval(function () {
        if (document.getElementById("cke_32")) {
            document.getElementById("cke_32").remove();
        }
    }, 1000);
</script>
<style>
    .form-control {
        border-radius: 0px;
    }
    .web-menu{
        display:none;
    }
    .web-col-2{
        height:0;
    }
    .ms-options-wrap > button:focus, .ms-options-wrap > button {

        max-width: 400px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* On screens that are 992px wide or less, the background color is blue */
    @media screen and (max-width: 992px) {

    }

    /* On screens that are 600px wide or less, the background color is olive */
    @media screen and (max-width: 992px),@media screen and (max-width: 600px) {
        .header{
            margin-top: -55px!important;
            height: 58px;
            overflow: hidden;
            transition:.8s;
        }
        .left-menu{
            z-index: 9;
            padding-right: 0;
            width: 0px;
            overflow-x: hidden;
            background: #f9f9f9;
            transition:.8s;
            height: 100%;margin-left: -15px;
        }
        .web-logo{
            margin-bottom:10px;
        }
        .web-menu {
            position: fixed;
            left: 10px;
            bottom: 10px;
            cursor: pointer;
            height: 40px;
            width: 40px;
            background-color:#b9e9b8 !important; 
            z-index: 9999;
            display: block;
            -webkit-border-radius: 60px;
            -moz-border-radius: 60px;
            border-radius: 60px;
            padding: 0px;
            text-align: center;
            font-size: 22px;
            color: white;
            top: 8px;
            left: 10px;
            transition:.8s;
        }
        .bar1, .bar2, .bar3 {
            width: 25px;
            height: 3px;
            background-color: #fff;
            margin: 6px 8px;
            transition: 0.4s;
        }

        .change .bar1 {
            -webkit-transform: rotate(-45deg) translate(-9px, 8px);
            transform: rotate(-45deg) translate(-9px, 8px);
        }

        .change .bar2 {opacity: 0;}

        .change .bar3 {
            -webkit-transform: rotate(45deg) translate(-5px, -4px);
            transform: rotate(45deg) translate(-5px, -4px);
        }
        .m-left{
            left:unset;
            right:10px;font-size:19px;
        }
        .ads div{
            padding:0;
        }
        #blog-post{    word-break: break-word;}
        #blog-post img{
            width:100% !important;
            height:100%!important;
        }
        #blog-post .blog-by {
            font-size: 12px;
        }
        #blog-post h1,#blog-post h2,#blog-post h3{
            font-size:20px;
        }
        .my-ask {
            border: 1px solid #03bc00;
            margin-top: 0px;
            display: block;
            float: unset !important;
        }
        .col-md-12 .col-md-9, .col-md-12 .col-md-8, .col-md-12 .col-md-10{
            padding:0;
        }
        .nav {
            display: inline-block;
        }
        .s-col {
            line-height: 30px;
        }

        .nav li{
            display: inline-block;
            border-top:2px solid tranparent;
            width: auto;
        }
        .nav > li > a {
            border-top: 3px solid transparent;
        }

        #myprofile .table-responsive {
            border: 0px solid #ddd;
        }
        .ms-options-wrap > button:focus, .ms-options-wrap > button {

            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .alert{
            margin-top:10px;
        }

    }
    #myprofile .table > thead > tr > th,#myprofile .table > tbody > tr > th,#myprofile .table > tfoot > tr > th,#myprofile .table > thead > tr > td,#myprofile .table > tbody > tr > td,#myprofile .table > tfoot > tr > td {
        border-top: 0px solid #ddd;
    }

</style>
<script>
    function menuopen(x) {
        x.classList.toggle("change");
        document.getElementById('leftmenu').style.width = '275px';
        document.getElementById('leftmenu').style.marginLeft = '0px';
        if ($("#webmenu").attr("onclick") == 'menuopen(this)') {
            $("#webmenu").attr("onclick", "menuclose(this)");
        } else {
            $("#webmenu").attr("onclick", "menuopen(this)");
        }
        document.getElementsByClassName('header')[0].style.height = '58px';
        closesearch();
    }
    function menuclose(x, d) {
        x.classList.toggle("change");
        document.getElementById('leftmenu').style.width = '0px';
        document.getElementById('leftmenu').style.marginLeft = '-15px';
        if ($("#webmenu").attr("onclick") == 'menuopen(this)') {
            $("#webmenu").attr("onclick", "menuclose(this)");


        } else {
            $("#webmenu").attr("onclick", "menuopen(this)");

        }
        document.getElementsByClassName('header')[0].style.height = '58px';
        closesearch();
    }
    function menusearch(x) {
        if (document.getElementsByClassName('header')[0].offsetHeight == '58') {
            document.getElementsByClassName('header')[0].style.height = '103px';
            document.getElementById('searchbox').style.top = '104px';
        } else {
            document.getElementsByClassName('header')[0].style.height = '58px';
        }
    }
</script>
<script src="https://myinboxhub.co.in/assets/js/bootstrap-notify.js" type="text/javascript"></script>
<script src="https://myinboxhub.co.in/assets/js/bootstrap-notify.min.js" type="text/javascript"></script>
<script>
    function notificationAlert(msg) {
        $.notify({
            // options
            icon: 'glyphicon glyphicon-warning-sign',
            title: ' ',
            message: msg,
            url: 'https://github.com/mouse0270/bootstrap-notify',
            target: '_blank'
        }, {
            // settings
            element: 'body',
            position: null,
            type: "danger",
            allow_dismiss: true,
            newest_on_top: false,
            showProgressbar: false,
            placement: {
                from: "top",
                align: "right"
            },
            offset: 20,
            spacing: 10,
            z_index: 1031,
            delay: 5000,
            timer: 1000,
            url_target: '_blank',
            mouse_over: null,
            animate: {
                enter: 'animated fadeInDown',
                exit: 'animated fadeOutUp'
            },
            onShow: null,
            onShown: null,
            onClose: null,
            onClosed: null,
            icon_type: 'class',
            template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-{0}" role="alert">' +
                    '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
                    '<span data-notify="icon"></span> ' +
                    '<span data-notify="title">{1}</span> ' +
                    '<span data-notify="message">{2}</span>' +
                    '<div class="progress" data-notify="progressbar">' +
                    '<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
                    '</div>' +
                    '<a href="{3}" target="{4}" data-notify="url"></a>' +
                    '</div>'
        });
    }
</script>
<script> $(document).ready(function () {
        $('[data-toggle="tooltip"]').tooltip();
    });</script>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "ItemList",
    "itemListElement": [
    {
    "@type": "ListItem",
    "position": 1,
    "url": "https://myinboxhub.co.in/blogs/Tutorial-5-Session-Data-CodeIgniter-PHP-Framework"
    },
    {
    "@type": "ListItem",
    "position": 2,
    "url": "https://myinboxhub.co.in/blogs/how-to-work-with-google-assistant-on-your-iphone-and-android-smartphone"
    },
    {
    "@type": "ListItem",
    "position": 3,
    "url": "https://myinboxhub.co.in/blogs/What-is-Laravel-and-how-to-install-at-localhost"
    }
    ]
    }
</script>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "VideoObject",
    "name": "Redmi Y2 Tech Review",
    "description": "Namasty dosto is video maine Xiaom Redmi Y2 bare mein baat krunga, or sath hi Redmi Y2 ke kuch key features aapke sath share krunga. 1. Dual 12MP + 5MP cameras width Precise bokeh effect. 2. 16MP front camera width 4500K soft-toned light.",
    "thumbnailUrl": "https://myinboxhub.co.in/data/yt/y2.png",
    "uploadDate": "2018-08-05 T20:00:00+05:30",
    "duration": "PT6M59S",
    "publisher": {
    "@type": "Organization",
    "name": "MyinboxHub",
    "logo": {
    "@type": "ImageObject",
    "url": "https://myinboxhub.co.in/data/logo/logo.png",
    "width": 600,
    "height": 60
    }
    },
    "contentUrl": "https://youtu.be/WGWVpct9KT4",
    "embedUrl": "https://www.youtube.com/watch?v=WGWVpct9KT4&t=38s",
    "interactionCount": "150"
    }
</script>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "VideoObject",
    "name": "Learn How to Store Session Data Variable in CodeIgniter in Hindi | By Yogendra Tomar",
    "description": "Namaskar dosto is video mein aap ko btaunga ki aap Session mein data kese store, retrieve or remove kare sath hi kuch CI session functions ko bhi explain krunga in hindi.",
    "thumbnailUrl": "https://myinboxhub.co.in//Ci_Session.png",
    "uploadDate": "2018-08-12 T13:49:00+05:30",
    "duration": "PT8M21S",
    "publisher": {
    "@type": "Organization",
    "name": "MyinboxHub",
    "logo": {
    "@type": "ImageObject",
    "url": "https://myinboxhub.co.in/data/yt/logo.png",
    "width": 600,
    "height": 60
    }
    },
    "contentUrl": "https://youtu.be/LFZ5sdzgWF4",
    "embedUrl": "https://www.youtube.com/embed/LFZ5sdzgWF4",
    "interactionCount": "150"
    }
</script>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "VideoObject",
    "name": "Integrating Google Sign-In into your web app using javaScript in Hindi | By Yogendra Tomar",
    "description": "Namaskar dosto, aaj ke video tutorial mein baat krunga kese aap google sign in ko integrate kr sakte hai aap apne website mein using javaScript hindi mein.",
    "thumbnailUrl": "https://i.ytimg.com/vi/NT3fgLDc3Tk/maxresdefault.jpg",
    "uploadDate": "2018-08-18 T23:33:00+05:30",
    "duration": "PT8M03S",
    "publisher": {
    "@type": "Organization",
    "name": "MyinboxHub",
    "logo": {
    "@type": "ImageObject",
    "url": "https://i.ytimg.com/vi/NT3fgLDc3Tk/maxresdefault.jpg",
    "width": 600,
    "height": 60
    }
    },
    "contentUrl": "https://youtu.be/NT3fgLDc3Tk",
    "embedUrl": "https://www.youtube.com/embed/NT3fgLDc3Tk",
    "interactionCount": "150"
    }
</script>
<script type="application/ld+json">
    {

    "@context": "https://schema.org",
    "@type": "Organization",
    "url": "https://myinboxhub.co.in/",
    "logo": "https://myinboxhub.co.in/data/logo/logo.png"

    }
</script>


<!-- Quantcast Tag -->
<script type="text/javascript">
    var _qevents = _qevents || [];

    (function () {
        var elem = document.createElement('script');
        elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
        elem.async = true;
        elem.type = "text/javascript";
        var scpt = document.getElementsByTagName('script')[0];
        scpt.parentNode.insertBefore(elem, scpt);
    })();

    _qevents.push({
        qacct: "p-dwtVcJQCWmxD7"
    });
</script>

<noscript>
<div style="display:none;">
    <img src="//pixel.quantserve.com/pixel/p-dwtVcJQCWmxD7.gif" border="0" height="1" width="1" alt="Quantcast"/>
</div>
</noscript>
<!-- End Quantcast tag -->
<script src="https://myinboxhub.co.in/data/js/boot-custom-js.js"></script>