Mufleeh Posted July 13, 2011 Share Posted July 13, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/241884-php-graph/ Share on other sites More sharing options...
Exoskeletor Posted July 13, 2011 Share Posted July 13, 2011 use mysql_num_rows http://php.net/manual/en/function.mysql-num-rows.php maybe for your case this is what you need, but im not sure: $num_rows = mysql_num_rows($count); Quote Link to comment https://forums.phpfreaks.com/topic/241884-php-graph/#findComment-1242175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.