I can get the possible combinations printed, but I need to do more than print. Taking the first character of the new element and separating it from the rest of the element, I have two variables that are supposed to connect with the other stuff within the script and execute the msyql query. This doesn't happen and results vary. Any suggestions as to what I'm doing wrong (code below) and how it can be fixed?
Code: Select all
function showCombinations($string, $autoshows, $i)
{
if ($i >= count($autoshows))
{
echo trim($string) . "<br>";
}
else
{
foreach ($autoshows[$i] as $autoshow)
showCombinations("$string$autoshow", $autoshows, $i + 1);
$type = substr($autoshows,1);
$level = substr($autoshow,0,1);
--MYSQL QUERY INSERT--
$showID = mysql_insert_id();
$amount1 = 150;
foreach(range(0, $amount1-1) as $value)
{
--MYSQL QUERY INSERT--
--MYSQL QUERY INSERT--
}
}
}
$autoshows =
array (
array(1,2,3),
array(dog,cat,mouse,elephant)
);
showCombinations('', $autoshows, 0);
echo "<b>Made!</b>";