Attempt to read property on null sometime |
HI , sorry for english , i have a proble with a model the problem occours sometime not always , if i refresh the same page the system work without error . This is the problem in log :
Code: CRITICAL - 2022-09-20 02:22:18 --> Attempt to read property "id_piani_campate" on null Code: function piani_campate_from_locazione($id_locazioni_piani) this is the part of controller where error occour: Code: $post = $this->request->getPost(); Code: public function ricerca_locazione_materiale($id_imballo) How can i solve ? why if i refresh the error disappear ?
Found error , the problem is on some record of locazioni_piani table , deleted manually by add deleted_at on db . Because normally i delete every of piani campate . change sql query in this way :
[CODE] $query = " SELECT locazioni_piani.nome as nome_locazione,locazioni_piani.id as id_locazione_piano, piani_campate.numero as numero_piani_campate, campate_scaffali.numero as numero_campata_scaffale, scaffali.nome as nome_scaffale FROM locazioni_piani JOIN piani_campate on (locazioni_piani.id_piani_campate=piani_campate.id) JOIN campate_scaffali on (campate_scaffali.id=piani_campate.id_campate_scaffali) JOIN scaffali on (scaffali.id=campate_scaffali.id_scaffali) WHERE piani_campate.id_imballi = '$id_imballo' AND ISNULL(locazioni_piani.deleted_at) AND ISNULL(piani_campate.deleted_at) AND ISNULL(locazioni_piani.id_materiale) ORDER BY RAND() LIMIT 1"; [CODE] The error sometime is because have rand() ... Sorry my mistake |
Welcome Guest, Not a member yet? Register Sign In |