Binding array params to query string

so i have been having some trouble binding my array parameters to my query string i have try’ed using the default pdo bindParams but i could not seem to get it to work right from within a foreach loop. so i currently tried using str_replace and preg_replace but in both cases the params seem to replace then revert back on the second iteration.

im really lost on what else to try or maybe a different way to go about this task.

public function execute(){
		$statement = $this->_statements[$this->_query_count][0];
		$params    = $this->_statements[$this->_query_count][1];
		if(count($params) > 0){
			// currently where im trying to replace the found placeholders in the query string
                        // with the an assoc array that identifies the the placeholder with the value.
			foreach($params as $k => $v){
				$k = str_replace(':' , '' , $k);
				$qs = preg_replace('/\\:['.$k.']+/i' , $v , $statement);
				
			}
			
			var_dump($qs);
			//var_dump($transaction->execute());
			//$this->_columns_count = $transaction->columnCount();
			//$this->_affected_rows = $transaction->rowCount();	
		}else{
			$transaction = $this->_lid->prepare($statement);
		    $transaction->execute();
			$this->_columns_count = $transaction->columnCount();
			$this->_affected_rows = $transaction->rowCount();	
		}
		
		//$this->_statements[$this->_query_count] = $transaction;
		//return $this;
	}

A big mistake I made with PDO initially was assuming that I could use placeholders for the field names, it only works for values:

eg this won’t work:

“update users set ? = ?” you have to do “update users set name = ?”

Not sure if you are making similar error or not… just saying.