How to add variable in query as column?

Asked

Viewed 53 times

1

How do I add the variable $pesq as column of a query ( not query) query?

$pesq = mysqli_real_escape_string($dbcon , $_POST['pesq']);
$pesquisa = mysqli_real_escape_string($dbcon , $_POST['pesquisa']);
$sql = "SELECT * FROM tbcliente WHERE '$pesq' = '$pesquisa'";
  • Search point? in column names not put single quotes.

  • it’s... it was just to take out the quotation msm... q burro... brigado rray

  • I edited so that people understand better, I think this is what I wanted, if not just click on "Reverse": https://answall.com/posts/218510/revisions

  • Yes it is possible! just remove those simple quotes, as long as the field exists in the table will work.

No answers

Browser other questions tagged

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