What I'm doing wrong I have this sql statement that should throw me 1
and is throwing me 0
my code with prepared query:
<?php
session_start();
include"conexion.php";
$me=$_SESSION["id"];
$id= $_GET["id"];
$sql=$conexion->prepare("SELECT de,para FROM amigos WHERE de=? AND para=?");
$sql->bind_param('ii', $me, $para);
$sql->execute();
$rows=$sql->num_rows;
echo $rows;//esto deberia arrojarme 1 pero me arroja 0
$sql->close();
?>
but if the query is not prepared if it gives me the expected result
<?php
session_start();
include"conexion.php";
$me=$_SESSION["id"];
$id= $_GET["id"];
$sql=$conexion->query("SELECT de,para FROM amigos WHERE de='$me' AND para='$id'");
echo $sql->num_rows;//resultado esperado 1
someone can give me a hand I'm just starting to learn the object-oriented form thanks!