0

I have a php script, which looks up a translation for a given word:

$word = "the";
$db = new PDO("sqlite:words.sqlite");
$sth = $db->prepare("SELECT word, translation FROM words where word = ?");
$sth->execute(array($word]));

However, I wish to replace the string variable $word with an array called $words and look up the translations for a set of words. Can I execute a single statement to retrieve all of these values? How is this implemented in terms of code?

4

1 回答 1

0

将 Mysql 函数 IN 与您的数组结合使用。请参阅之前的堆栈帖子:我可以将数组绑定到 IN() 条件吗?

于 2013-08-14T16:59:49.813 回答