function get_schools() { $connection = connect(); //2.perform query $query = "SELECT * from school"; $result = mysqli_query($connection, $query); confirm_query($result); colse_connection($connection); return $result; }
public function deleteAction(Request $request, Role $role) { $form = $this->createDeleteForm($role); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $id = $role->getId(); $connection = connect(); $query = "delete from role where id = {$id} limit 1"; $result = mysqli_query($connection, $query); confirm_query($result); colse_connection($connection); } return $this->redirectToRoute('role_index'); }
function get_all_children_by_role_id($id) { $connection = connect(); //2.perform query $query = "SELECT * FROM child left outer join child_has_school on id=child_id "; $query .= "where school_id in "; $query .= "(SELECT distinct school_id FROM user left outer join user_has_school on id=user_id "; $query .= "where user_id='{$id}')"; $result = mysqli_query($connection, $query); confirm_query($result); $children = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($children, $row); } colse_connection($connection); return $children; }
function insertuser($postData) { echo dump($postData); $connection = connect(); echo dump($postData); //$gardian = new Applicant(); $applicant = $postData; $NameInFull = mysqli_real_escape_string($connection, $applicant['name_full']); $NameInInitials = mysqli_real_escape_string($connection, $applicant['name_initials']); $username = mysqli_real_escape_string($connection, $applicant['username']); $password = sha1(mysqli_real_escape_string($connection, $applicant['password'])); $emp_no = mysqli_real_escape_string($connection, $applicant['emp_no']); $role_id = $applicant['role']; $query = "insert into user ("; $query .= " name_in_full,name_in_intials, user_name,password, emp_no,role_id"; $query .= ") values( "; $query .= " '{$NameInFull}','{$NameInInitials}','{$username}','{$password}','{$emp_no}',{$role_id}"; $query .= ")"; $result = mysqli_query($connection, $query); if ($result) { } colse_connection($connection); return null; }
function get_all_children() { $connection = connect(); //2.perform query $query = "SELECT * from child"; $result = mysqli_query($connection, $query); confirm_query($result); colse_connection($connection); return $result; }
/** * Deletes a ChildrenOfStaff entity. * * @Route("/{id}", name="childrenofstaff_delete") * @Method("DELETE") */ public function deleteAction(Request $request, ChildrenOfStaff $childrenOfStaff) { $form = $this->createDeleteForm($childrenOfStaff); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $id = $childrenOfStaff->getId(); $connection = connect(); $query = "delete from children_of_staff where id = {$id} limit 1"; $result = mysqli_query($connection, $query); confirm_query($result); colse_connection($connection); } return $this->redirectToRoute('childrenofstaff_index'); }
/** * Deletes a School entity. * */ public function deleteAction(Request $request, School $school) { $form = $this->createDeleteForm($school); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { /*$em = $this->getDoctrine()->getManager(); $em->remove($school); $em->flush();*/ $id = $school->getId(); $connection = connect(); $query = "delete from school where id = {$id} limit 1"; $result = mysqli_query($connection, $query); confirm_query($result); colse_connection($connection); } return $this->redirectToRoute('school_index'); }
public function showAllAction(Child $child) { $id = $child->getId(); $applicant_id = $child->getApplicant()->getId(); $connection = connect(); $query = "SELECT * from children_of_staff where applicant_id = '{$applicant_id}'"; $result = mysqli_query($connection, $query); confirm_query($result); $childrenOfStaff = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($childrenOfStaff, $row); } $query = "SELECT * from childern_of_studying_at_present where applicant_id = '{$applicant_id}'"; $result = mysqli_query($connection, $query); confirm_query($result); $childernOfStudyingAtPresent = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($childernOfStudyingAtPresent, $row); } $query = "SELECT * from children_of_otoeos where applicant_id = '{$applicant_id}'"; $result = mysqli_query($connection, $query); confirm_query($result); $childrenOfOtoeo = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($childrenOfOtoeo, $row); } $query = "SELECT * from children_of_past_pupils where applicant_id = '{$applicant_id}'"; $result = mysqli_query($connection, $query); confirm_query($result); $childrenOfPastPupil = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($childrenOfPastPupil, $row); } colse_connection($connection); //$childrenOfPastPupil = $this->getDoctrine()->getRepository('ApplicationBundle:ChildrenOfPastPupils')->find($applicant); return $this->render('child/showall.html.twig', array('child' => $child, 'childrenOfStaff' => $childrenOfStaff, 'childernOfStudyingAtPresent' => $childernOfStudyingAtPresent, 'childrenOfOtoeo' => $childrenOfOtoeo, 'childrenOfPastPupil' => $childrenOfPastPupil)); }
function updateRole($data, $role) { $connection = connect(); $id = $role->getId(); $role->setRole(mysqli_real_escape_string($connection, $data['role'])); $role->setDescription(mysqli_real_escape_string($connection, $data['description'])); $query = "UPDATE role SET "; $query .= "role = '{$role->getRole()}', "; $query .= "description = '{$role->getDescription()}' "; $query .= "WHERE id = {$id} "; $query .= "LIMIT 1"; echo $query; $result = mysqli_query($connection, $query); confirm_query($result); colse_connection($connection); }