0

Not sure what is the right syntax of the pdo->quote. php.net shows only "echo $stmt->quote($var)". But I don't need to "echo" this variable. How should I save the result and transfer it to request?

With the first string $stmt uncommented I receive bool(false). Without it all works just fine.

//$var1 = $this->_db->quote($var1);
$stmt = $this->_db->query("SELECT activation FROM users WHERE email = '$var1' LIMIT 1");
Cœur
  • 34,719
  • 24
  • 185
  • 251
Kirill Ivanov
  • 67
  • 1
  • 8

1 Answers1

0

quote() adds it's own quotation marks, so remove them from the query.

$var1 = $this->_db->quote($var1);
$stmt = $this->_db->query("SELECT activation FROM users WHERE email = $var1 LIMIT 1");

Have you considered using prepared statements? http://www.php.net/manual/en/pdo.prepare.php

mcrumley
  • 5,592
  • 3
  • 24
  • 31