src/Drivers/AbstractDriver.php
public function prepareQuery(string $sql, array $data): ?PDOStatement
	{
		// Prepare the sql, save the statement for easy access later
		$this->statement = $this->prepare($sql);

		// Bind the parameters
		foreach($data as $k => $value)
		{
			// Parameters are 1-based, the data is 0-based
			// So, if the key is numeric, add 1
			if(is_numeric($k))
			{
				$k++;
			}
			$this->statement->bindValue($k, $value);
		}

		return $this->statement;
	}
public function prepareQuery(string $sql, array $data): ?PDOStatement
	{
		// Prepare the sql, save the statement for easy access later
		$this->statement = $this->prepare($sql);

		// Bind the parameters
		foreach($data as $k => $value)
		{
			// Parameters are 1-based, the data is 0-based
			// So, if the key is numeric, add 1
			if(is_numeric($k))
			{
				$k++;
			}
			$this->statement->bindValue($k, $value);
		}

		return $this->statement;
	}
public function prepareQuery ( string $ sql , array $ data ) : ? PDOStatement { // Prepare the sql, save the statement for easy access later $ this -> statement = $ this -> prepare ( $ sql ) ; // Bind the parameters foreach ( $ data as $ k => $ value ) { // Parameters are 1-based, the data is 0-based // So, if the key is numeric, add 1 if ( is_numeric ( $ k ) ) { $ k ++ ; } $ this -> statement -> bindValue ( $ k , $ value ) ; } return $ this -> statement ; }
Simplifies prepared statements for database queries

@param string $sql
@param array $data
@return PDOStatement | FALSE
@throws InvalidArgumentException
Simplifies prepared statements for database queries