Luciano Luciano - 11 days ago 5
PHP Question

Loop in variable php

$createquery=' "Select * from provaEngine where keyword like "%'.$int[$y] .'%" '.while(isset($lol[$var])){echo $lol[$var]}.' ';


How can i put all the $lol variable into the $createquery variable without using a loop ?

Answer

You can use implode function to generate a comma separated list as follows:

$createquery=' "Select * from provaEngine where keyword IN (implode(', ', $lol));
Comments