I'm working on showing the data from the DB using html table and google charts. In one part of the script im using an IF loop,that is very important.It operates the things that's gonna be shown on the screen.But the IF loop doesn't work like it should be.
<?php if($IF==3){ ?>
<div class='row'>
<div class='col-md-4'>
<div id="first" style="width: 900px; height: 500px;"></div>
</div>
<div class='col-md-4'>
<div id="second" style="width: 900px; height: 500px;"></div>
</div>
<div class='col-md-4'>
<div id="third" style="width: 900px; height: 500px;"></div>
</div>
</div>
<?php
} else if($IF==2){ ?>
<div class='row'>
<div class='col-md-6'>
<div id="first" style="width: 900px; height: 500px;"></div>
</div>
<div class='col-md-6'>
<div id="second" style="width: 900px; height: 500px;"></div>
</div>
</div>
<?php }else{?>
<div class='row'>
<div class='col-md-12'>
<div id="first" style="width: 900px; height: 500px;"></div>
</div>
</div>
<?php } ?>
Let's explain what i wanted to do here.If the variable $IF equals 3 (number of employees) it shows 3 pie charts,and this part works.It shows the right data and the right amount of pie charts. But the problem appears when $IF<2. The pie charts won't show. Am i doing this the wrong way? Thx in advance.
I've solved the problem,when I was creating the charts for 3 employees i had to send 3 different types of data in the script.BUT,when there were only 2 or 1 employee the variables that saved the data for the second or third were empty,and that created an error.It couldn't create a chart when the variables were empty.So i just added a simple IF loop to manage that