如何在sql查询中编写php代码?

the code is like this

$sql="SELECT tahun FROM tahunajar ";

i want the value of $sql can write in this query

$sql1= "SELECT * FROM soal where idSoal LIKE '-->HERE<--' "; 

can someone tell me how do it?

Ofcourse, you can write it via like this

$sql1= "SELECT * FROM soal where idSoal IN (".$sql.") "; 

Simply use the variable in double quoted string. It will work. Following is the example:

$sql1= "SELECT * FROM soal where idSoal LIKE $sql"; 

You can learn more from HERE.