How can I query a database using the results of a prior query if they are in array? Below is what I have thus far.
$query = "SELECT * from searchtestdb where engname in ( SELECT synonyms.synonym FROM words LEFT JOIN synonyms ON synonyms.word_id = words.word_id WHERE word LIKE '%$searchBox%') ";
while($result = mysql_fetch_array($query))
{
echo $result['engname'];
echo "<br> ";
echo "<br> ";
}
How can I get the $result['engname'] and query again? I'm thinking something like
SELECT * from searchtestdb where engname LIKE '%$result['engname']%';
but that obviously doesn't work. Any ideas?
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.