$querystring1 = "select * from events order by eid"; $conn1 = DB\connect_db($config); //$conn= DB\connect_db($config); //$conn=555; $conn = DB\connect_db($config); if ($conn) { $results = DB\get_db("select eid,count(*) from participants group by eid", $conn); if ($results) { foreach ($results as $i) { $event[] = array($i[0] => $i[1]); } } } try { // print_r($event); $resultspro = DB\get_db($querystring, $conn); if ($resultspro) { $i = 0; //$redemo=$resultspro; //print_r($results1); while ($row = $resultspro->fetch(\PDO::FETCH_OBJ)) { $redemo[] = array('eid' => $row->eid, 'exp' => $row->expentries); $per = 0; $ee = 0; if (isset($event[$i][$row->eid])) { $ee = $event[$i][$row->eid]; } if ($ee == 0) { $per = 0; } else { $per = $ee / $row->expentries * 100;
<tr> <td> </td> <td>Name</td> <td><input type="text" name="name" id="name" class="" style="width:250px" placeholder="participant name" onKeyPress="return isAlphabet(event)"></td> <td> </td> </tr> <tr> <td> </td> <td>Event</td> <td><select name="event" id="event" class="ui-spinner ui-widget ui-widget-content ui-corner-all" style="width:150px;font-size:12px" placeholder="select event"> <option value="0" style="color:#999">select</option> <?php $conn = DB\connect_db($config); if ($conn) { $binding = array(); $results = DB\get_db("select eid,name from events", $conn); if ($results) { foreach ($results as $i) { echo "<option class=\"ui-spinner-input\" value=\"" . $i[0] . "\">" . $i[1] . " </option>"; } } } ?> </select></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td>