WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a function in Wordpress, which should update one field status to 0. But no changes are made to the database. I don't know what is the reason. Can someone please help. I tried looking into wordpress own wp-db.php, and seen that the same array is going there as well.

        function updateData($temp_array){
            global $wpdb;
            $temp_array = array('status', '0');
            echo $wpdb->update( 'wp_testing_options', $temp_array, array( 'id' => 1 ) );
        }
share|improve this question
up vote 0 down vote accepted

this:

$temp_array = array('status', '0');

should be

$temp_array = array('status' => '0');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.