$_GET['id'] does not return value

Asked

Viewed 111 times

2

I do a search with in mysql, but $_GET['id'] does not show, although it shows in the address bar : http://localhost/t-shirts/index.php? funcao=edit$id=18

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

Why doesn’t return the id number like this?

  • Beware of SQL Injection! http://pt.wikipedia.org/wiki/Inje%C3%A7%C3%A3o_de_sql ...... You should use Mysqli/PDO and Prepared statements

2 answers

4

Change that: $id=18

for this: &id=18

  • 1

    Put, thanks man, that was it

0


@Besides, although this question has already been answered there is something wrong with your code there is a natural form of a & of the URL turn a $ even when sending a <form> using the GET method (parameters in the URL) it colonizes altomatically the & separating the variaveispassed through the URL, another scenario is 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.

  • Thanks @Ricardohenrique, I’m still starting, thanks for the tip

  • I already upvoted at the same time

Browser other questions tagged

You are not signed in. Login or sign up in order to post.