$ _GET ['id'] does not return value

2

I do a search with in mysql, but the $ _GET ['id'] does not show, although it shows in the address bar: link $ id = 18

    $sql = mysqli_query($conexao, "SELECT * FROM produtos WHERE id= '". $_GET['id'] ."'");

Why does not the id number return like this?

    
asked by anonymous 28.04.2015 / 21:12

2 answers

0

@AleMoraes, although this question has already been answered there is something wrong with your code there is no natural way for a & of the URL to become a $ even when sending a <form> using the GET method ( parameters in the URL), it automatically computes the & by separating the variaveis passed by the URL, another scenario is that you have built this URL with

$parametros = http_build_query($objeto);

http://localhost/camisetas/index.php?id=18&name=bill&sobrenome=gates

the URL would be completely formatted.

    
02.05.2015 / 15:56
4

Change this: $id=18

for this: &id=18

    
28.04.2015 / 21:13