I have an half PHP/half algorithmic question. I will have random inputs between 0 and 4. they will be used in the same query such as
<?php SELECT * FROM `table` WHERE inputs in (input0,input1,input2) //for 3 inputs
SELECT * FROM `table` WHERE inputs in (input0,input1) //for 2 inputs
//do nothing for zero inputs ?>
I believe this is the start point.
<?php
function myfunc(){
$args = func_get_args();
foreach ($args as $arg)
echo $arg."/n";
}
myfunc('hello', 'world', '.');
?>
Now I think I can run the foreach loop n times for n individual inputs but I couldn't figure out how to use them in the query effectively. Can I create an array and pass it somehow to the query as inputs?
thanks
arda
implode(",",func_get_args())?