Good to know how to solve this error:
Fatal error: Uncaught Error: Call to a member function fetch_array() on boolean in C:\xampp\htdocs\Horarios\paginas\actualizarsubjects.php:12
Stack trace: #0 {main} thrown in C:\xampp\htdocs\Horarios\paginas\actualizarsubjects.php on line 12
and that is simply that I want to take data from one form to another in different pages my main key in the database is varchar
, when bringing them if I only write numbers shows them but, if I write letters and numbers As I want, I get that error, I appreciate your help.
<?php
session_start();
require_once "../php/connect.php";
if(!$_SESSION['verificar']){
//
}
else {
require_once "../php/connect.php";
$usu =$_GET['codigomateria'];
$query="SELECT codigomateria,creditos,nombre FROM materias WHERE codigomateria=".$usu;
$consulta1=$mysqli->query($query);
while($fila=$consulta1->fetch_array(MYSQLI_ASSOC)){
$codigomateria=$fila['codigomateria'];
$nombre=$fila['nombre'];
$creditos=$fila['creditos'];
}
}
echo $_SESSION['user'];
? >