for loop counting issue in php -
i have 2 loop fetching questions database.questions associated parameter. there 3 parameters having different number of questions. doing is-
for($j=0; $j<count(parameter); $j++) { echo parameter[$j]['name']; for($m=0; $m<count($question); $m++) { echo $m.'. '$question['description']; } }
its output is:
location
- correct address , contact details of asc, in company systems, website & sms tool , matching.
- contactability on landline & mobile no of asc
facilities
- ventilation, lighting, power backup & airconditioning of asc
- infotainment system
- drinking water & new paper
avm
- look & feel, color code of asc, parameters
- glow sign board
- uniforms
- notice board in waiting area per latest guidelines
location ,facilities,avm parameters having 2-3 questions listing 1,2 again 1,2,3 1,2,3,4 want 1,2,3,4 9 counting
try below code
$count = 1; for($j=0;$j<count(parameter);$j++){ echo parameter[$j]['name']; for($m=0;$m<count($question);$m++){ echo $count.'. '$question['description']; $count += 1; } }
Comments
Post a Comment