// Multi word look up serperated by the pipe character // Format: word1 | word2 | word3 or word1|word2|word3 elseif (preg_match('#^([^|]+\s*\|\s*[^|]+(\s*\|\s*[^|]+)*)$#i', $m[1], $multi)) { // Clear any white space seperating the pipes and explode the results $words = preg_replace('#(\s+\||\|\s+)#', '', trim($multi[1])); $words = explode("|", $words); // Clean and format the words array for ($i=0;$i< 1) { // Creates the word key index used in the PDO query for($i=0;$idb->prepare(' SELECT word, karma, ROWID id FROM karmas WHERE word IN ('.implode(',', $kwords).') ORDER BY karma DESC '); // Combine the words and the word key index and execute the query $res = $fetchMultiKarma->execute(array_combine($kwords, $words)); if ($res) { while (($row = $res->fetch(PDO::FETCH_ASSOC))) { $this->doPrivmsg($source, 'Debug: '.$row['word'].' => '.$row['karma']); } } } // Use the old karma fetch method if theres only one word else { $this->fetchKarma->execute(array(':word'=>$words[0])); $res = $this->fetchKarma->fetch(PDO::FETCH_ASSOC); if ($res && $res['karma'] != 0) { $this->doPrivmsg($source, $words[0].' has karma of '.$res['karma'].'.'); } else { $this->doPrivmsg($source, $words[0].' has neutral karma.'); } } }