Jump to content

PHP Graph


Mufleeh

Recommended Posts

Hi,

 

I need to plot a graph for Math teaches vs division for a given zone. I will be using js to draw the graph so I need to make up the table first. The table I need is some thing like this.

 

 

   

Division1

   

Division2

   

Division3

   

Division4

   

Division5

 

 

   

No.Of teachers in division1

   

No.Of teachers in division2

   

No.Of teachers in division3

   

No.Of teachers in division4

   

No.Of teachers in division5

 

 

Below is how I select the zone,'

 

 <p><b>Select the Zone to Generate the Graph for Mathematics Teacher Distribution:</b></p>
                                                        
                            <form method="post" id="graphMathsTeacherbyDivision" action="<?php echo $_SERVER['SCRIPT_NAME']?>">
                                                        
                            <select name="selectZone">

                                                
                            <?php foreach($this->allZones as $zone)
                            {
                             echo "<option";
                             echo " value='$zone[zone_id]' ";
                             echo ">";
                             echo $zone['zone_id'].": ".$zone['zone_name'];
                             echo "</option>";
                             }?>
                             					
                             </select>
                                              
                             <input type="submit" name='zone_id' value="Generate Graph"/>
                                                            
                             </form></br></br>

 

 

 

Below is how I have written the query,

 

 

				   
				$selectZone = $_POST['selectZone'];

				$query = $this->dbh->prepare("SELECT division_id FROM view_zone_division_district_province WHERE zone_id='$selectZone'");
				$query->execute();
				$divisions = $query->fetchall();


				foreach($divisions as $div)
				{		

				$queryMe = $this->dbh->prepare("SELECT nic FROM view_teachers_current_school_appointment WHERE appointment_category_name = 'Mathematics' AND census_id IN (SELECT census_id FROM view_schools WHERE division_id = '$div[division_id]')");

				$queryMe->execute();
				$count = $queryMe->fetchall();


				}

 

What I need to is to get the number of teachers from second query. I tried it writing count($count) but it doesn't give me the count. Please let me know how to do this?

 

If you can please let me know below also,

 

I need to create the table (as above) which gives the division and the respective number of teachers in that division. Please advice.

 

 

Regards,

Mufleeh

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.