0

i can explain with an example

$sorgu=$db->prepare("SELECT * FROM table WHERE name=:name1 OR name=:name2");
$sorgu->execute(['name1' => "John",'name2' => "Aydin"]);
$cikti=$sorgu->fetchAll(PDO::FETCH_ASSOC);

i can get what i want this way but should there be a more practical way? is there like this one way?

$answers=['John','Aydin'];
$sorgu=$db->prepare("SELECT * FROM table WHERE name=:names");
$sorgu->execute(['names' => $answers]);
$cikti=$sorgu->fetchAll(PDO::FETCH_ASSOC);

i think this isn't work but i want to know there's should better way?

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43

0 Answers0