public function updateDetail() { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = sprintf("UPDATE `dept_detail` SET `home_page_desc`='%s'", mysql_real_escape_string($this->detail)); if (!mysqli_query($con, $sql)) { throw new Exception("Cannot Update Data"); } else { getConnection::closeConnection($con); return 1; } } catch (Exception $e) { getConnection::closeConnection($con); echo 'Message: ' . $e->getMessage(); } }
function login($username, $password) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $num = Alumni_Detail::getNoOfAlumni($username, $password); if ($num == 1) { $alu = Alumni_Detail::getAlumniObject($username); if ($alu->alumni_status == 1) { session_start(); $_SESSION['alumniuser'] = $alu; return 1; } else { return 2; } } else { return 0; getConnection::closeConnection($con); } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); getConnection::closeConnection($con); } }
public static function getAllFeedbacks() { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM feedback_detail ORDER BY feedback_id DESC"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $feed = ""; while ($row = mysqli_fetch_array($result)) { $c = new Feedback_Detail($row['feedback_id'], $row['feedback_date'], $row['feedback_person_name'], $row['feedback_person_email'], $row['feedback_detail']); $feed[$count] = $c; $count++; } return $feed; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllDetail($cat) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM `credit_system` WHERE `credit_system_programme`='" . mysql_real_escape_string($cat) . "'"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $details = ""; while ($row = mysqli_fetch_array($result)) { $c = new credit_system($row['credit_system_title'], $row['credit_system_desc'], $row['credit_system_programme']); $details[$count] = $c; $count++; } return $details; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllQualificationOfFaculty($id) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM `faculty_qualification` WHERE faculty_id='" . mysql_real_escape_string($id) . "' ORDER BY faculty_year_of_passing DESC"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $qualification = ""; while ($row = mysqli_fetch_array($result)) { $c = new faculty_qualification_class($row['qualification_id'], $row['faculty_id'], $row['faculty_degree'], $row['faculty_year_of_passing'], $row['faculty_institute_name']); $qualification[$count] = $c; $count++; } return $qualification; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getImagesObject($id) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM slider_photos WHERE photo_id='" . mysql_real_escape_string($id) . "'"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive Images from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $row = mysqli_fetch_array($result); $c = new Slider_PhotoClass($row['photo_id'], $row['url'], $row['category_id'], $row['caption'], $row['status']); return $c; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllLogdate($date) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM `site_log` WHERE date(substring(`log_time` from 1 for 10))='" . mysql_real_escape_string($date) . "'"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $log = ""; while ($row = mysqli_fetch_array($result)) { $c = new site_log($row['log_id'], $row['log_time'], $row['log_uname'], $row['log_ip'], $row['log_desc']); $log[$count] = $c; $count++; } return $log; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllstudent($cat) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM student WHERE student_programme='" . mysql_real_escape_string($cat) . "'"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive Students from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $std = ""; while ($row = mysqli_fetch_array($result)) { $c = new Student($row['student_id'], $row['student_first_name'], $row['student_last_name'], $row['student_email'], $row['student_linkedin_id'], $row['student_resume_url'], $row['student_batch'], $row['student_cgpa'], $row['student_specialization'], $row['student_programme']); $std[$count] = $c; $count++; } return $std; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllTopNewsEvents($ti) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM `news_events` WHERE news_events_type='" . mysql_real_escape_string($ti) . "' ORDER BY news_events_date DESC LIMIT 0,10"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $course = ""; while ($row = mysqli_fetch_array($result)) { $c = new news_event_class($row['news_events_id'], $row['news_events_date'], $row['news_events_desc'], $row['news_events_url'], $row['news_events_type']); $course[$count] = $c; $count++; } return $course; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
throw new Exception("Cannot connect to the database"); } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } return $con; } public static function selectDatabase($con) { try { mysqli_select_db($con, self::$db_database); if (mysqli_error($con)) { throw new Exception("Cannot Select the database."); } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } } public static function closeConnection($connection) { try { mysqli_close($connection); } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } } } $cone = getConnection::connectToDatabase(); getConnection::selectDatabase($cone); getConnection::closeConnection($cone);
public static function getAllCoursecat($cat) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM course_detail WHERE course_programme='" . mysql_real_escape_string($cat) . "' "; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $course = ""; while ($row = mysqli_fetch_array($result)) { $c = new course($row['course_id'], $row['course_name'], $row['course_credit'], $row['course_programme'], $row['course_semester'], $row['course_url']); $course[$count] = $c; $count++; } return $course; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllCategories() { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM slider_category"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $category = ""; while ($row = mysqli_fetch_array($result)) { $c = new Slider_CategoryClass($row['category_id'], $row['category_name'], $row['category_color']); $category[$count] = $c; $count++; } return $category; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getRoles() { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM `role`"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $role = ""; while ($row = mysqli_fetch_array($result)) { $role[$row['role_id']] = $row['role_name']; } return $role; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getNoOfAlumni($uname, $pass) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM alumni_detail where alumni_uname='" . mysql_real_escape_string($uname) . "' and alumni_password='******'"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive Alumni's from database"); } $n = mysqli_num_rows($result); return $n; } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
<?php session_start(); require_once '../CMS/db/ConnectionClass.php'; $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); //if(!isset($_SESSION['slider_total'])) //{ // $totalresult=mysqli_query($con,"SELECT COUNT(*) FROM slider_photos"); // $row = mysqli_fetch_array($totalresult); // $total=$row['COUNT(*)']; // $result= mysql_query($con,"SELECT b.`category_id`, b.`category_name`, b.`category_color`, count(a.`photo_id`) as total from `slider_photos` a, `slider_category` b where a.`category_id`=b.`category_id` group by b.`category_id`"); // // $arr=array( // "0"=>array( // $total // ) // ); // // while($row = mysqli_fetch_array($result)) // { // $arr[$row['category_id']]=array( // $row['total'] // ); // } // $_SESSION['slider_total']=$arr; //} $ratio = 10; if (isset($_GET['start'])) { $page = $_GET['start']; $cat = -1;
public static function getAllSpcExecutiveobject($id) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM spc_executive WHERE spc_executive_id=" . mysql_real_escape_string($id); $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive Spc's from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } $row = mysqli_fetch_array($result); $c = new Spc_Executive($row['spc_executive_id'], $row['spc_executive_prefix'], $row['spc_executive_name'], $row['spc_executive_number'], $row['spc_executive_year']); return $c; } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function countblog($status) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT count(`blog_id`) count FROM `alumni_blog` WHERE `alumni_blog_status`=" . mysql_real_escape_string($status) . ""; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive Blogs from database"); } $row = mysqli_fetch_array($result); return $row['count']; } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllExperienceOfFaculty($id) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM `faculty_experience` WHERE faculty_id='" . mysql_real_escape_string($id) . "' "; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $experience = ""; while ($row = mysqli_fetch_array($result)) { $c = new faculty_experience_class($row['experience_id'], $row['faculty_id'], $row['faculty_institute'], $row['faculty_no_of_year'], $row['faculty_designation']); $experience[$count] = $c; $count++; } return $experience; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getID($name) { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM faculty_designation WHERE faculty_designation_name='" . mysql_real_escape_string($name) . "'"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return "false"; } else { $faculty = ""; while ($row = mysqli_fetch_array($result)) { $faculty = $row['faculty_designation_id']; return $faculty; } } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }
public static function getAllHorizonIssue() { $con = getConnection::connectToDatabase(); getConnection::selectDatabase($con); try { $sql = "SELECT * FROM horizon_issue"; $result = mysqli_query($con, $sql); if (!$result) { throw new Exception("Cannot Retrive data from database"); } $n = mysqli_num_rows($result); if ($n === 0) { return 0; } else { $count = 0; $issue = ""; while ($row = mysqli_fetch_array($result)) { $c = new Horizon_IssueClass($row['horizon_id'], $row['horizon_version'], $row['horizon_date'], $row['horizon_pdf_url'], $row['horizon_photo_url']); $issue[$count] = $c; $count++; } return $issue; } } catch (Exception $e) { echo 'Message: ' . $e->getMessage(); } getConnection::closeConnection($con); }