PHP - mysqli_errno=0 y aún asi aparece el Warning: mysqli_num_rows() expects...

 
Vista:

mysqli_errno=0 y aún asi aparece el Warning: mysqli_num_rows() expects...

Publicado por rocio (2 intervenciones) el 24/07/2017 02:37:07
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp1\htdocs\AGC_Aranjuez\_class\conexion.php on line 36
Error21: Error22: 0 Error23: 00000
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in C:\xampp1\htdocs\AGC_Aranjuez\_class\conexion.php on line 43
Error31: Error32: 0 Error33: 00000

Tengo una conección por procedimientos, y el código funciona:
conectar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function conectar(){
    $this->coneccion= mysqli_connect($this->host,$this->user,$this->pass,$this->db);
		// Si la conexión falla, aparece el error 
		if($this->coneccion === false) {
		 echo 'Ha habido un error: <br>'.mysqli_connect_error();
		}
    }   //funciona bien
	function consulta($que){
		if (!mysqli_query($this->coneccion,$que)) {
			 printf("Error11: %s\n", mysqli_error($this->coneccion));
   			 printf("Error12: %s\n", mysqli_errno($this->coneccion));
			 printf("Error13: %s\n", mysqli_sqlstate($this->coneccion));
		}else
		$this->resultado = mysqli_query($this->coneccion,$que) or die('Error: '.mysqli_error($this->coneccion));
 
		if (!mysqli_num_rows($this->resultado)) {
			 printf("Error21: %s\n", mysqli_error($this->coneccion));
   			 printf("Error22: %s\n", mysqli_errno($this->coneccion));
			 printf("Error23: %s\n", mysqli_sqlstate($this->coneccion));
		}else
		$this->num_rows = mysqli_num_rows($this->resultado) ;
 
		if (!mysqli_num_fields($this->resultado)) {
			 printf("Error31: %s\n", mysqli_error($this->coneccion));
   			 printf("Error32: %s\n", mysqli_errno($this->coneccion));
			 printf("Error33: %s\n", mysqli_sqlstate($this->coneccion));
		}else
		$this->num_field = mysqli_num_fields($this->resultado) ;
	} // //funciona bien
privilegios.php
<?
include("_class/clases.php");
require_once("_class/verifica_sale.php");
$insertar=new ads;
$insertar->conectar();
 
$c=$_GET["c"];
$e=$_GET["e"];
 
if($c=='1')
{
    $insertar->consulta("UPDATE privilegios SET
	 estado='0' WHERE id='$e'");
} else {
    $insertar->consulta("UPDATE privilegios SET
	 estado='1' WHERE id='$e'");
}
include("iagc_privilegios.php");
?>    // tambien funciona bien

La Pregunta es porque me sale ese molesto Warning: mysqli_num_rows() expects... y si pongo en function consulta($que){
....
....
$this->num_rows = mysqli_num_rows($this->resultado) or die('Error: '.mysqli_error($this->coneccion));
$this->num_field = mysqli_num_fields($this->resultado) or die('Error: '.mysqli_error($this->coneccion));
...
...

se interrumpe la ejecución como si realmente hubiera un error, cuando todos sus mensajes dicen que no hay error!!!

Ayuda por favor, ya busque y no encuentro respuestas.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder