I am writing a query for a sql input statement, i noticed that when using the PDO::PARAM_STR i need to specify a length. From the manual, i see that the length is “Length of the data type. To indicate that a parameter is an OUT parameter from a stored procedure, you must explicitly set the length.”
My problem is that I don’t understand what an OUT parameter is? If in my MySQl table the field im accessing is a varchar with 128 length, should the length of the PARAM_STR be set to 128? Sorry for my ignorance and thanks in advance.
You don’t need to set the length when binding an input parameter. Only when you are binding to the output of a function (also read stored procedure) does the length need to be specified (and only on certain DB platforms IIRC).