I have made great progress with my project but I have now struck a problem that has me stumped. It involves passing an array of values to an UPDATE query.
Here is the string that is being passed to the exec function (from the error report) split up to make it more compact rather than one long line:
DB\SQL->exec(['UPDATE eclectic SET 1st = ?, 2nd = ?, 3rd = ?, 4th = ?, 5th = ?, 6th = ?, 7th = ?, 8th = ?, 9th = ?, 10th = ?,
11th = ?, 12th = ?, 13th = ?, 14th = ?, 15th = ?, 16th = ?, 17th = ?, 18th = ?, Total = ?, ID = ?
WHERE Player_Initials = 'BOUH''],[[[1=>'4',2=>'5',3=>'3',4=>'3',5=>'4',6=>'5',7=>'3',8=>'3',9=>'4',10=>'4',11=>'3',12=>'2',
13=>'5',14=>'4',15=>'3',16=>'4',17=>'4',18=>'3',19=>'66',20=>'0']]])
I am a bit nonplussed about the number of square brackets around the data array and if you think this is the problem can
you guide as to how to reduce/eliminate them.
The failure error is: Invalid parameter number: number of bound variables does not match number of tokens
The variable count does match the number of tokens (as far as I can see) which is why I wonder about the number of sets of brackets.
This is the code in the 'model':
public function updateEclectic($buildSQL,$playerinits,$updata) {
return $this->db->exec("UPDATE eclectic SET $buildSQL WHERE Player_Initials = '$playerinits'", array($updata));
}
Thanks in anticipation.
Harry