I am writing an INSERT statement and I have an error that I can not solve in the following statement:
$stmt->bind_param("$tipo_var", $insert_valores);
It happens that the variable $ var_type is enclosed in commas, so that the types of each element of the "statement" that I send to MySQL are quoted.
The real data that the system receives is:
$stmt->bind_param('iiisssssssdiiiddsssidddssssssss',
2016, 2, 1, 'texto1', 'texto2', 'texto3', 'texto4', 'texto5', 'texto6',
'texto7', 0.01, 1, 1, 1, 0.01, 0.01, 'texto8', 'texto9', 'texto10', 11,
0.01, 0.01, 0.01, 'texto11', 'texto12', 'texto13', 'texto14', 'texto15',
'texto16', 'texto17', 'texto18')
That is, I do not find that there is a real error between the type string and the sent parameters, being that the order of each type is respected vs the variable sent.
The connection to the database and the types corresponding to each data that is sent to the database are correct, but it still gives me this error:
Warning: mysqli_stmt :: bind_param (): Number of elements in type definition string does not match number of bind variables in /pg2.php on line 318
Any suggestions?