0

I have this query to select and populate a table with some records but it keeps returning null no matter what I do.

I access the page through this a href:

<input type=button onClick="parent.location='http://intrasise.uprm.edu/registro4h/login/socios/socExist/modificar/modificarSocio.php?nombreEdit=<?php echo $row["nombre"] ?>&apellidoEdit=<?php echo $row["apellido"] ?>&idEdit=<?php echo $row["id"]?>

which gives me the variables above without any problem, but I add an "include_once" with this query:

$sql = "SELECT * FROM socios WHERE id = '".$_GET["idEdit"]."'";

    $result = $conn->query($sql);

    $res = null;
    $conn = null;
    $sql = null;

and it always returns null. I know it's a php problem cause the query works in phpmyadmin. If you need more info please let me know, can't figure it out for the life of me.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
jChris
  • 37
  • 7

1 Answers1

0

If you actually look for potential errors the result will probably tell you what you have done wrong.

$sql = "SELECT * FROM socios WHERE id = '".$_GET["idEdit"]."'";

$result = $conn->query($sql);
if ( ! $result ) {
    echo $conn->error;
}
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • added the if bit of code, returns no error. – jChris Sep 29 '15 at 16:06
  • done var_dump to the $row variable of the result, to the $conn variable, to the $sql variable, everything looks normal, like i've done in countless other queries – jChris Sep 29 '15 at 16:07