Closed motoroller1983 closed 1 year ago
Hi!
Can you please give an example of such Query Builder usage that would trigger this error?
Sure:
SELECT * FROM table
ORDER BY id = 7 DESC
No, I mean how do you use the framework's code. If you could show your example by using QB's methods, would be really great.
$BGs = $this->db->order_by("id = {$this->session->userdata['Background']['id']} DESC", NULL, FALSE)->get('table')->result_array();
In my project that I updated to PHP8.1, I had to check isset($var) before running various native PHP methods like htmlspecialchars($var). You could try it with trim($var):
if (isset($var)){trim($var)}
https://php.watch/versions/8.1/internal-func-non-nullable-null-deprecation
A PHP Error was encountered Severity: 8192
Message: trim(): Passing null to parameter #1 ($string) of type string is deprecated
Filename: libraries/Form_validation.php
Line Number: 1059
Backtrace:
File: C:\xampp\htdocs\sisurat\application\controllers\Admin\Masuk.php Line: 26 Function: run
File: C:\xampp\htdocs\sisurat\index.php Line: 315 Function: require_once
kalau ini gimana ya ?
kalau ini gimana ya ?
can you send your code?
function save(){ $id = $this->input->post('id'); $this->form_validation->set_rules('nama_kantin','nama_kantin','required'); $this->form_validation->set_rules('telpon','telpon','required'); $this->data = [ 'nama_kantin' => $this->input->post('nama_kantin'), 'telpon' => $this->input->post('telpon'), ]; if($this->form_validation->run() == FALSE){ $this->load->view('kantin/form',$this->data); }else{ if($id == ''){ $this->makanan->insert($this->data); }else{ $this->makanan->update($id,$this->data); } redirect(base_url('kantin')); } }
can you try this function save(){ $id = $this->input->post('id'); $this->form_validation->set_rules('nama_kantin','nama_kantin','required|min_length[5]'); $this->form_validation->set_rules('telpon','telpon','required'); $this->data = [ 'nama_kantin' => $this->input->post('nama_kantin')??'', 'telpon' => $this->input->post('telpon'), ]; if($this->form_validation->run() == FALSE){ $this->load->view('kantin/form',$this->data); }else{ if($id == ''){ $this->makanan->insert($this->data); }else{ $this->makanan->update($id,$this->data); } redirect(base_url('kantin')); } }
I don't understand what's with the latest comments added to this issue (or even if they are related), but regarding the initial report, you are not supposed to send the NULL
value for the $direction
parameter.
A PHP Error was encountered
Severity: 8192
Message: trim(): Passing null to parameter #1 ($string) of type string is deprecated
Filename: database/DB_query_builder.php
Line Number: 1204