PHP MYSQL (Modify Records) - Fatal error: Call to a member function bind_param () on boolean in update.php on line 13

-1

I hope you can help me, I want to modify records to a table of 44 fields, I have another related table for one of the fields, and I get the following error when wanting to modify something: Fatal error: Call to a member function bind_param () on boolean in C: \ xampp \ htdocs \ projects \ crud \ update.php on line 13

I leave my code, if someone finds the error I will thank you completely:

<?php
include "config.php";
include "header.php";
if(isset($_GET['u'])):
if(isset($_POST['bts'])):
    $stmt = $mysqli->prepare("UPDATE computadoras SET id_division=?, centroCosto=?, nombre=?, RPEresponsable=?,
    nombreResponsable=?, latitud=?, longitud=?, notasRevision=?, responsableTI=?, noInventario=?,
    tipo_propiedad=?, resguardoEconomico=?, velocidad=?, nombreEquipo=?, sistemaOperativo=?, direccionIP=?,
    direccionMAC=?, procesador=?, noProcesadores=?, memoria=?, capAlmacenamiento=?, infraCritica=?, funcional=?,
    procesoNegocio=?, tipo_uso=?, actTecnologica=?, no_serie=?, tipo_equipo=?, marca=?, modelo=?, antiguedad=?,
    entidad=?, municipio=?, domicilio=?, zipCode=?, reqMantto, fallas=?, descFalla=?, misionCritica=?, comentarios=?,
    notas=?, migrar=?, no_activoFijo=? WHERE id=?");
    $stmt->bind_param('ssssssssssssssssssssssssssssssssssssssssssss',$id_division,$centroCosto,$nombre,$RPEresponsable,
        $nombreResponsable,$latitud,$longitud,$notasRevision,$responsableTI,$noInventario,$tipo_propiedad,$resguardoEconomico,
        $velocidad,$nombreEquipo,$sistemaOperativo,$direccionIP,$direccionMAC,$procesador,$noProcesadores,$memoria,
        $capAlmacenamiento,$infraCritica,$funcional,$procesoNegocio,$tipo_uso,$actTecnologica,$no_serie,$tipo_equipo,
        $marca,$modelo,$antiguedad,$entidad,$municipio,$domicilio,$zipCode,$reqMantto,$fallas,$descFalla,$misionCritica,
        $comentarios,$notas,$migrar,$no_activoFijo,$id);

    $id_division = $_POST['id_division'];
    $centroCosto = $_POST['centroCosto'];
    $nombre = $_POST['nombre'];
    $RPEresponsable = $_POST['RPEresponsable'];
    $nombreResponsable = $_POST['nombreResponsable'];
    $latitud = $_POST['latitud'];
    $longitud = $_POST['longitud'];
    $notasRevision = $_POST['notasRevision'];
    $responsableTI = $_POST['responsableTI'];
    $noInventario = $_POST['noInventario'];
    $tipo_propiedad = $_POST['tipo_propiedad'];
    $resguardoEconomico = $_POST['resguardoEconomico'];
    $velocidad = $_POST['velocidad'];
    $nombreEquipo = $_POST['nombreEquipo'];
    $sistemaOperativo = $_POST['sistemaOperativo'];
    $direccionIP = $_POST['direccionIP'];
    $direccionMAC = $_POST['direccionMAC'];
    $procesador = $_POST['procesador'];
    $noProcesadores = $_POST['noProcesadores'];
    $memoria = $_POST['memoria'];
    $capAlmacenamiento = $_POST['capAlmacenamiento'];
    $infraCritica = $_POST['infraCritica'];
    $funcional = $_POST['funcional'];
    $procesoNegocio = $_POST['procesoNegocio'];
    $tipo_uso = $_POST['tipo_uso'];
    $actTecnologica = $_POST['actTecnologica'];
    $no_serie = $_POST['no_serie'];
    $tipo_equipo = $_POST['tipo_equipo'];
    $marca = $_POST['marca'];
    $modelo = $_POST['modelo'];
    $antiguedad = $_POST['antiguedad'];
    $entidad = $_POST['entidad'];
    $municipio = $_POST['municipio'];
    $domicilio = $_POST['domicilio'];
    $zipCode = $_POST['zipCode'];
    $reqMantto = $_POST['reqMantto'];
    $fallas = $_POST['fallas'];
    $descFalla = $_POST['descFalla'];
    $misionCritica = $_POST['misionCritica'];
    $comentarios = $_POST['comentarios'];
    $notas = $_POST['notas'];
    $migrar = $_POST['migrar'];
    $no_activoFijo = $_POST['no_activoFijo'];
    $id = $_POST['id'];

    if($stmt->execute()):
        echo "<script>location.href='computadoras.php'</script>";
    else:
        echo "<script>alert('".$stmt->error."')</script>";
    endif;
endif;
$res1 = $mysqli->query("SELECT * FROM divisiones");
$row1 = $res1->fetch_assoc();
$res = $mysqli->query("SELECT * FROM computadoras WHERE id=".$_GET['u']);
$row = $res->fetch_assoc();
?>

<p>
</p>
<div class="panel panel-default">
<div class="panel-body">

<form role="form" method="post">
    <input type="hidden" value="<?php echo $row['id'] ?>" id="id" name="id"/>
    <div class="form-group">
        <label for="id_division">División</label>
        <input type="text" class="form-control" name="id_division" id="id_division" value="<?php echo $row1['id_division'] ?>">
    </div>
    <div class="form-group">
        <label for="centroCosto">Centro de Costo</label>
        <input type="text" class="form-control" name="centroCosto" id="centroCosto" value="<?php echo $row['centroCosto'] ?>">
    </div>
    <div class="form-group">
        <label for="nombre">Nombre</label>
        <input type="text" class="form-control" name="nombre" id="nombre" value="<?php echo $row['nombre'] ?>">
    </div>
    <div class="form-group">
        <label for="RPEresponsable">RPE del Responsable</label>
        <input type="text" class="form-control" name="RPEresponsable" id="RPEresponsable" value="<?php echo $row['RPEresponsable'] ?>">
    </div>
    <div class="form-group">
        <label for="nombreResponsable">Nombre del Responsable</label>
        <input type="text" class="form-control" name="nombreResponsable" id="nombreResponsable" value="<?php echo $row['nombreResponsable'] ?>">
    </div>
    <div class="form-group">
        <label for="latitud">Latitud</label>
        <input type="text" class="form-control" name="latitud" id="latitud" value="<?php echo $row['latitud'] ?>">
    </div>
    <div class="form-group">
        <label for="longitud">Longitud</label>
        <input type="text" class="form-control" name="longitud" id="longitud" value="<?php echo $row['longitud'] ?>">
    </div>
    <div class="form-group">
        <label for="notasRevision">Notas de RevisióresponsableTIn</label>
        <input type="text" class="form-control" name="notasRevision" id="notasRevision" value="<?php echo $row['notasRevision'] ?>">
    </div>
    <div class="form-group">
        <label for="responsableTI">Responsable de TI</label>
        <input type="text" class="form-control" name="responsableTI" id="responsableTI" value="<?php echo $row['responsableTI'] ?>">
    </div>
    <div class="form-group">
        <label for="noInventario">Número de Inventario (BIA)</label>
        <input type="text" class="form-control" name="noInventario" id="noInventario" value="<?php echo $row['noInventario'] ?>">
    </div>
    <div class="form-group">
        <label for="tipo_propiedad">Tipo de Propiedad</label>
        <input type="text" class="form-control" name="tipo_propiedad" id="tipo_propiedad" value="<?php echo $row['tipo_propiedad'] ?>">
    </div>
    <div class="form-group">
        <label for="resguardoEconomico">Resguardo Economico</label>
        <input type="text" class="form-control" name="resguardoEconomico" id="resguardoEconomico" value="<?php echo $row['resguardoEconomico'] ?>">
    </div>
    <div class="form-group">
        <label for="velocidad">Velocidad</label>
        <input type="text" class="form-control" name="velocidad" id="velocidad" value="<?php echo $row['velocidad'] ?>">
    </div>
    <div class="form-group">
        <label for="nombreEquipo">nombreEquipo</label>
        <input type="text" class="form-control" name="nombreEquipo" id="nombreEquipo" value="<?php echo $row['nombreEquipo'] ?>">
    </div>
    <div class="form-group">
        <label for="sistemaOperativo">sistemaOperativo</label>
        <input type="text" class="form-control" name="sistemaOperativo" id="sistemaOperativo" value="<?php echo $row['sistemaOperativo'] ?>">
    </div>
    <div class="form-group">
        <label for="direccionIP">direccionIP</label>
        <input type="text" class="form-control" name="direccionIP" id="direccionIP" value="<?php echo $row['direccionIP'] ?>">
    </div>
    <div class="form-group">
        <label for="direccionMAC">direccionMAC</label>
        <input type="text" class="form-control" name="direccionMAC" id="direccionMAC" value="<?php echo $row['direccionMAC'] ?>">
    </div>
    <div class="form-group">
        <label for="procesador">procesador</label>
        <input type="text" class="form-control" name="procesador" id="procesador" value="<?php echo $row['procesador'] ?>">
    </div>
    <div class="form-group">
        <label for="noProcesadores">noProcesadores</label>
        <input type="text" class="form-control" name="noProcesadores" id="noProcesadores" value="<?php echo $row['noProcesadores'] ?>">
    </div>
    <div class="form-group">
        <label for="memoria">memoria</label>
        <input type="text" class="form-control" name="memoria" id="memoria" value="<?php echo $row['memoria'] ?>">
    </div>
    <div class="form-group">
        <label for="capAlmacenamiento">capAlmacenamiento</label>
        <input type="text" class="form-control" name="capAlmacenamiento" id="capAlmacenamiento" value="<?php echo $row['capAlmacenamiento'] ?>">
    </div>
    <div class="form-group">
        <label for="infraCritica">infraCritica</label>
        <input type="text" class="form-control" name="infraCritica" id="infraCritica" value="<?php echo $row['infraCritica'] ?>">
    </div>
    <div class="form-group">
        <label for="funcional">funcional</label>
        <input type="text" class="form-control" name="funcional" id="funcional" value="<?php echo $row['funcional'] ?>">
    </div>
    <div class="form-group">
        <label for="procesoNegocio">procesoNegocio</label>
        <input type="text" class="form-control" name="procesoNegocio" id="procesoNegocio" value="<?php echo $row['procesoNegocio'] ?>">
    </div>
    <div class="form-group">
        <label for="tipo_uso">tipo_uso</label>
        <input type="text" class="form-control" name="tipo_uso" id="tipo_uso" value="<?php echo $row['tipo_uso'] ?>">
    </div>
    <div class="form-group">
        <label for="actTecnologica">actTecnologica</label>
        <input type="text" class="form-control" name="actTecnologica" id="actTecnologica" value="<?php echo $row['actTecnologica'] ?>">
    </div>
    <div class="form-group">
        <label for="no_serie">no_serie</label>
        <input type="text" class="form-control" name="no_serie" id="no_serie" value="<?php echo $row['no_serie'] ?>">
    </div>
    <div class="form-group">
        <label for="tipo_equipo">tipo_equipo</label>
        <input type="text" class="form-control" name="tipo_equipo" id="tipo_equipo" value="<?php echo $row['tipo_equipo'] ?>">
    </div>
    <div class="form-group">
        <label for="marca">marca</label>
        <input type="text" class="form-control" name="marca" id="marca" value="<?php echo $row['marca'] ?>">
    </div>
    <div class="form-group">
        <label for="modelo">modelo</label>
        <input type="text" class="form-control" name="modelo" id="modelo" value="<?php echo $row['modelo'] ?>">
    </div>
    <div class="form-group">
        <label for="antiguedad">antiguedad</label>
        <input type="text" class="form-control" name="antiguedad" id="antiguedad" value="<?php echo $row['antiguedad'] ?>">
    </div>
    <div class="form-group">
        <label for="entidad">entidad</label>
        <input type="text" class="form-control" name="entidad" id="entidad" value="<?php echo $row['entidad'] ?>">
    </div>
    <div class="form-group">
        <label for="municipio">municipio</label>
        <input type="text" class="form-control" name="municipio" id="municipio" value="<?php echo $row['municipio'] ?>">
    </div>
    <div class="form-group">
        <label for="domicilio">domicilio</label>
        <input type="text" class="form-control" name="domicilio" id="domicilio" value="<?php echo $row['domicilio'] ?>">
    </div>
    <div class="form-group">
        <label for="zipCode">zipCode</label>
        <input type="text" class="form-control" name="zipCode" id="zipCode" value="<?php echo $row['zipCode'] ?>">
    </div>
    <div class="form-group">
        <label for="reqMantto">reqMantto</label>
        <input type="text" class="form-control" name="reqMantto" id="reqMantto" value="<?php echo $row['reqMantto'] ?>">
    </div>
    <div class="form-group">
        <label for="fallas">fallas</label>
        <input type="text" class="form-control" name="fallas" id="fallas" value="<?php echo $row['fallas'] ?>">
    </div>
    <div class="form-group">
        <label for="descFalla">descFalla</label>
        <input type="text" class="form-control" name="descFalla" id="descFalla" value="<?php echo $row['descFalla'] ?>">
    </div>
    <div class="form-group">
        <label for="misionCritica">misionCritica</label>
        <input type="text" class="form-control" name="misionCritica" id="misionCritica" value="<?php echo $row['misionCritica'] ?>">
    </div>
    <div class="form-group">
        <label for="comentarios">comentarios</label>
        <input type="text" class="form-control" name="comentarios" id="comentarios" value="<?php echo $row['comentarios'] ?>">
    </div>
    <div class="form-group">
        <label for="notas">notas</label>
        <input type="text" class="form-control" name="notas" id="notas" value="<?php echo $row['notas'] ?>">
    </div>
    <div class="form-group">
        <label for="migrar">migrar</label>
        <input type="text" class="form-control" name="migrar" id="migrar" value="<?php echo $row['migrar'] ?>">
    </div>
    <div class="form-group">
        <label for="no_activoFijo">no_activoFijo</label>
        <input type="text" class="form-control" name="no_activoFijo" id="no_activoFijo" value="<?php echo $row['no_activoFijo'] ?>">
    </div>
    <button type="submit" name="bts" class="btn btn-success">Modificar Registro</button>
</form>
<?php
endif;
include "footer.php";
?>
    
asked by Alejandro Jiménez 05.04.2016 в 18:25
source

2 answers

0

You have (at least) an error in the UPDATE, that causes $mysqli->prepare to fail, $stmt will have the value FALSE and, since it is not an object, it will not have the method bind_param (which is the fault that is shown ).

The error is here:

 ... zipCode=?, reqMantto, fallas=?, ...

column reqMantto should have a =? because it is a UPDATE and you should assign a value to it. If after correcting that you still fail, you should verify that the other names of the columns are well written, otherwise the UPDATE will not be valid and you will get the same error.

    
answered by 06.04.2016 / 06:06
source
0

prepare() gives you a boolean if there is an error, so you should have a condition that verifies it if it is FALSE , you must also determine why it is delivering that value, if it is an error in the names of the table / columns or in the query.

    
answered by 05.04.2016 в 18:34