I'm trying to use a query to pull a specific ID
from another page.
I can get ID
through $_GET
, I printed the query to see if it was right, even though it did not show me what error it was.
Code:
<?php
$mysqli = new mysqli('localhost', 'root', '', 'dog_house');
if(!$mysqli)
die(mysql_error());
$codigo = $_GET['cod'];
echo $codigo;//Ver a PK
$sql = "SELECT * FROM 'filhotes' WHERE $codigo";
echo $sql;//Ver a Query
if ($mysqli->query($sql) === TRUE) {
echo "Update no banco feito";
} else {
echo "Erro:". $mysqli->error;
}
?>
I did the test taking this query and running right through phpMyAdmin
and it worked, I do not need in that case an array of querys is just a specific tuple, but the error and $mysqli->error
does not tell me what the error is.