MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/login_cafsindia_com/bend/dbconnect.php
<?php
class dbconnect {	
	protected $db;
	
	private $host     = "localhost";
	private $username = "root";
	private $password = "";
	private $database = "national";
	
	public function open_db(){
		$this->db = new mysqli($this->host, $this->username, $this->password, $this->database);
		if(mysqli_connect_errno()){
			return false;
		}else{
			return true;
		}
	}
	
	public function runQuery($query) {
		$result = mysqli_query($this->db,$query);
		if(!$result){
			echo("Error description: ".mysqli_error($this->db)."<br/>");
			return false;
		}else{
			return $result;
		}		
	}
	
	public function result($result){
		$data = array();
		while ($obj = mysqli_fetch_object($result)) {
			if($obj){				
				$data[] = $obj;
			}
		}
		return $data;
	}
	
	public function num_rows($result){
		return mysqli_num_rows($result);
	}
	
	public function close_db(){
		mysqli_close($this->db);
	}
}
?>