public function prepare($query)
	{
		if (!$this->isOpen) { $this->throwError("It's not connected to the database",""); return null; }
		$this->lastParam=[];
		$this->lastQuery = $query;
		if ($this->readonly) {
			if (stripos($query, 'insert ') === 0 || stripos($query, 'update ') === 0 || stripos($query, 'delete ') === 0) {
				// we aren't checking SQL-DCL queries.
				$this->throwError("Database is in READ ONLY MODE","");
			}
		}
		if ($this->logLevel>=2) {
			$this->storeInfo($query);
		}

		try {
			$stmt = $this->conn1->prepare($query);
		} catch (Exception $ex) {
			$stmt=false;
			$this->throwError("Failed to prepare",$ex->getMessage(),json_encode($this->lastParam));
		}
		if ($stmt === false) {
			$this->throwError("Unable to prepare query",$this->lastQuery,json_encode($this->lastParam));
		}
		return $stmt;
	}
public function prepare($query)
	{
		if (!$this->isOpen) { $this->throwError("It's not connected to the database",""); return null; }
		$this->lastParam=[];
		$this->lastQuery = $query;
		if ($this->readonly) {
			if (stripos($query, 'insert ') === 0 || stripos($query, 'update ') === 0 || stripos($query, 'delete ') === 0) {
				// we aren't checking SQL-DCL queries.
				$this->throwError("Database is in READ ONLY MODE","");
			}
		}
		if ($this->logLevel>=2) {
			$this->storeInfo($query);
		}

		try {
			$stmt = $this->conn1->prepare($query);
		} catch (Exception $ex) {
			$stmt=false;
			$this->throwError("Failed to prepare",$ex->getMessage(),json_encode($this->lastParam));
		}
		if ($stmt === false) {
			$this->throwError("Unable to prepare query",$this->lastQuery,json_encode($this->lastParam));
		}
		return $stmt;
	}
public function prepare ( $ query ) { if ( ! $ this -> isOpen ) { $ this -> throwError ( "It's not connected to the database" , "" ) ; return null ; } $ this -> lastParam = [ ] ; $ this -> lastQuery = $ query ; if ( $ this -> readonly ) { if ( stripos ( $ query , 'insert ' ) === 0 || stripos ( $ query , 'update ' ) === 0 || stripos ( $ query , 'delete ' ) === 0 ) { // we aren't checking SQL-DCL queries. $ this -> throwError ( "Database is in READ ONLY MODE" , "" ) ; } } if ( $ this -> logLevel >= 2 ) { $ this -> storeInfo ( $ query ) ; } try { $ stmt = $ this -> conn1 -> prepare ( $ query ) ; } catch ( Exception $ ex ) { $ stmt = false ; $ this -> throwError ( "Failed to prepare" , $ ex -> getMessage ( ) , json_encode ( $ this -> lastParam ) ) ; } if ( $ stmt === false ) { $ this -> throwError ( "Unable to prepare query" , $ this -> lastQuery , json_encode ( $ this -> lastParam ) ) ; } return $ stmt ; }
Prepare a query. It returns a mysqli statement.
@param $query string
@return \mysqli_stmt returns the statement if correct otherwise null
@throws Exception
Prepare a query . It returns a mysqli statement .