I am creating a questionnaire for a client that requires the questions to be organized by 3 layers of levels. I\'ve successfully created the U.I. however I\'ve been trying f
Do this recursivly:
function printChildQuestions($parentid) {
$sql="SELECT * FROM pB_test WHERE parentID=$parentid";
$result=mysql_query($sql);
$i=0;
while (true) {
$row=mysql_fetch_array($result);
if (!$row) break;
if ($i==0) echo "";
$i=1;
echo '- '.$row['id'].' '.$row['description'].' '.$row['parentId'].'
';
printChildQuestions($row['id']);
}
if ($i>0) echo '
';
}
printChildQuestions(0);