TransWikia.com

Warning error: Trying to access array offset on value of type null php 7.4

Stack Overflow en español Asked by deathgran2013 on January 1, 2022

Hola buenos días estoy teniendo problemas con la version 7.4 en esta consulta que realizo

$consult = $mysqli->query("SELECT name FROM status WHERE id = '$oldstatus' ");
$register = $consult->fetch_assoc();
$oldstatus = $register['name'];

One Answer

Buen día, para evitar este tipo de error, tiene que agregar una condición de isset para validar que exista la variable.

$consult = $mysqli->query("SELECT name FROM status WHERE id = '$oldstatus' ");
$register = $consult->fetch_assoc();
if(isset($register['name'])){
    $oldstatus = $register['name'];
}

Answered by Ervin Santos on January 1, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP