logo
Tags down

shadow

Codeigniter: Get affected fields in update


By : Ramim
Date : October 17 2020, 11:12 AM
it helps some times I needed this exact functionality so I wrote this code. It returns the number of fields that were affected.
FUNCTION STARTS:
code :


Share : facebook icon twitter icon

Codeigniter db->update() VS MySQL native UPDATE Affected rows: 0


By : bluerebelsmoke2710
Date : March 29 2020, 07:55 AM
this one helps. Try getting the query that CodeIgniter is running using the following code:
code :
$this->db->last_query();

Crud in Codeigniter not affected when Update to database


By : user1412488
Date : March 29 2020, 07:55 AM
I wish this help you Hope this will help you :
You have disabled you id_song input type in your form just remove disabled attr from it
code :
 <div class="form-group">
    <label for="userName">id_songs </label>
    <input type="text" 
           name="id_song" 
           value="<?php echo $data->id_song; ?>" 
           class="form-control"  id="userName">
 </div>   
    <input type="hidden" 
           name="id_song" 
           parsley-trigger="change" required
           value="<?php echo $data->id_song; ?>" 
           class="form-control"  id="userName">     

I want affected rows data and column which has affected by update query in codeigniter


By : user3043880
Date : March 29 2020, 07:55 AM
will be helpful for those in need As far as I know there are no built-in CodeIgniter functionality for that. You could compare old value with new value though :
code :
$last_record = $this->db->get_where('table1', array('id' => $id))->row_array();
$this->db->query("UPDATE `table1` SET name = $name,......................,column10=10 WHERE id=$id")->result();
// $this->db->affected_rows();
$new_record = $this->db->get_where('table1', array('id' => $id))->row_array();
$affected_columns = array_diff($new_record, $last_record);
foreach ($affected_columns as $field => $value) {
    echo "[field] : $field\r\n";
    echo "[old_value] : $last_record[$field]\r\n";
    echo "[new_value] : $value\r\n";
    echo "\r\n";
}

mysql database update and codeigniter rows affected function


By : Daniel Munteanu
Date : March 29 2020, 07:55 AM
hop of those help?
yes i understand what i need is the confirmation that query has successfully run.

get id of affected row in codeigniter after an update


By : julio maclay
Date : March 29 2020, 07:55 AM
I wish this helpful for you How do i get the id of the affected row after doing an update in CodeIgniter?
Related Posts Related Posts :
  • Access gmail or yahoo mail using script
  • Checking for an empty field with MySQL
  • How can I cut an image from the bottom using PHP?
  • Remove multiple whitespaces
  • Why is unserialize_callback_func needed when spl_autoload_register is already used?
  • draw binary tree with php
  • How do I parse a string for a particular delimited section within PHP?
  • Building gearman type application using RabbitMQ
  • Animated favicon call from php
  • How do I get the local system time in PHP?
  • Trying to validate captcha with javascript before sending to php form validation
  • how to bind to an openldap server
  • What are the real advantages of templating engines over just using PHP?
  • PHPTAL i18n Call to a member function on a non-object Error
  • getting notice in php file while executing
  • What web server should I install?
  • Is this php code safe?
  • Hunting cheaters in a voting competition
  • Web bot in C++/PHP
  • PHP date format converting
  • How to Retrieve image from database?
  • How to add curl support to PHP 5 in CentOS
  • How can I pass in an array as a value into a PHP soapclient request?
  • does Apache caches the SESSION data in memory when I use the file handler for session?
  • How can I search all of the databases on my mysql server for a single string of information
  • Login without HTTPS, how to secure?
  • PHP /MySQL - *-to-Many Relationships
  • What situations demand the use of eval() because there are no alternatives?
  • php security question
  • PHP preg_match help please. Pretty simple
  • php time function
  • iterate through range of numbers to add as keys
  • find part of a word and then replace the whole word with a string
  • Memory leak with preg_replace
  • <tbody> glitch in PHP Simple HTML DOM parser
  • How I can create doc file from php file
  • How can I store HTML color codes in a MySQL database then search for a range or colors?
  • PHP SoapClient: Problems with Distributed WSDL File
  • ajax rating script - avoid voting again
  • Firefox Upload Form Issue
  • PHP Redirect by Browser Language not working!
  • Get MySQL data without stressing server
  • how to get value from the database
  • Make one field unique depending on another field
  • I'm getting a php warning: cannot modify header information (but I have my include file before the html code!)
  • PHP Architecture: How do I do that?
  • fileinfo and mime types I've never heard of
  • Categorising a large mysql result with php while?
  • Adodb, escaping quotes?
  • How to get ID value with jquery and send to PHP script?
  • High Cache Miss From Memcache When Storing Sessions
  • Drupal Form API and $form_state['storage'] is destroyed on a page refresh
  • auto run a php file
  • The problem about move_uploaded_file() function in php
  • convert txt or doc to pdf using php
  • Zend session_start gives Fatal error: Exception thrown without a stack frame in Unknown on line 0
  • javascript string replace equivalent on php?
  • At my wits end on sleep()
  • What is a good algorithm or library for cropping images to avoid whitespace or empty areas?
  • Is this a PHP or MySQL bug?
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org