2
I’m trying to use a query to pull one ID
specific that comes from another page.
I can receive the ID
for $_GET
, i printed the query to see if it was right, even so of the error and does not show me which error 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 by taking this query and running right through the phpMyAdmin
and it worked, I don’t need in this case an array of querys is just a specific tuple, but the error and $mysqli->error
don’t tell me what the mistake is.
$codigo
has something likecodigo = 1
remember to specify which field you want to compare. You put an example of what the query output is like– rray