I want to compare two information tables equal and I want to know which ones match and which ones do not
<?php
//Clase para manejar la conexion a la base de datos
class Connect
{
private $user = "root";//usuario de mysqlk
private $pass = "";//clave de mysql
private $base = "radius";//base de datos en mysql
private $server = "localhost";//servidor de alojamiento
public $error;//en caso de error se almacena aqui
public $db;
public function __construct(){
$mysqli = new mysqli($this->server, $this->user, $this->pass, $this->base);
if ($mysqli->connect_errno) {
$this->error = "Fallo al conectar a MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$this->db = $mysqli;
}
}
//Clase trabajo que se extiende de Connect
class Trabajo extends Connect
{
public function __construct(){
parent::__construct();
}
public function valida($x){
$a = $this->db->query("SELECT * FROM archivos_de_pagos WHERE referencia = '$x' ");
$t = $a->num_rows;
if($t>=1){
//Si el cliente realizó el pago retorno la información
$row = $a->fetch_object();
return $row;
}else{
//si no retorno falso
return false;
}
}//
public function data(){
$a = $this->db->query("SELECT * FROM pagos_pagina");
echo "<table>
<thead>
<th>Numero</th>
<th>Cliente</th>
<th>Estatus</th>
<th>Referencia</th>
</thead>
";
$con=1;
while($row = $a->fetch_object()){
//Envío a validar la referencia del cliente
$valida = $this->valida($row->referencia);
if($valida){
echo "<tr>
<td>".$con."</td>
<td>".$row->nombre." ".$row->apellido."</td>
<td>Pago Validado</td>
<td>".$valida->referencia."</td>
</tr>";
}else{
echo "<tr>
<td>".$con."</td>
<td>".$row->nombre." ".$row->apellido."</td>
<td>Pago Invalido</td>
<td>".$row->referencia."</td>
</tr>";
}
$con++;
}
echo "</table>";
}
}
$p = new trabajo();
$p->data();
?>
I get the following error:
Notice: Trying to get property of non-object in C: \ xampp \ htdocs \ superconex \ login \ new.php on line 27
// this is my line 27
$t = $a->num_rows;
the version of my php is PHP: 5.6.33