Problem sending array from Controller to Model in Codeigniter

Problem sending array from Controller to Model in Codeigniter

Good evening. For learning purposes I am building a CRUD script with the possibility for drag and drop rows using ajax. While sending the data from the controller to the model, my model function is unable to treat the array so I am encountering a problem.

Good evening. For learning purposes I am building a CRUD script with the possibility for drag and drop rows using ajax. While sending the data from the controller to the model, my model function is unable to treat the array so I am encountering a problem.

Controller function:

public function from_ajax() {
    $this->load->model('model');
    $ordem = $this->input->post('ordem');
    parse_str($ordem, $array_ordenado);
    var_dump($array_ordenado); //testing only
    $resultado = $this->model->reordem($array_ordenado);
    echo json_encode($resultado);           
}

var_dump on controller output:

array(1) { ["teste"]=> array(4) { [0]=> string(1) "1" [1]=> string(1) "3" [2]=> string(1) "2" [3]=> string(1) "4" } }

Here is my model function:

public function reordem($data) {
    $this->db->select('page_order');
    $this->db->from('tbl_posts');
    return $this->db->update('tbl_posts', $data);
}

How would I treat this array dump on my model function so I can get the value I want (the ones inside "")?

I'm also getting this error: php/database error Thank you for your time!

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Cannot send array to php via AJAX?

Well I followed&nbsp;<a href="https://stackoverflow.com/questions/9001526/send-array-with-ajax-to-php-script" target="_blank">this</a>&nbsp;question, but cannot send array to php it returns me always empty:

PHP Interview Questions with Solutions: Prepare for PHP Interview

Prepare for PHP Interviews. Set Variable With php.ini File. Logic & Output Behind PHP Code Segment. Class Concept, Error & Functions in PHP. Start PHP Now!

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...