I am now fully comfortable with writing MySQLi prepared statements and binding variables like in the code below:
$stmt->bind_param('ssssi',$this->OrderNumber,$this->Comment,$this->Code,$this->Amount,$this->TransDate,$this->FirstCollectionDate,$this->FileName,$id);
The thing is, I am now updating some code in a script which generates a database class for all the tables in my system. With methods such as Get, Save, Delete etc. etc.
I have a foreach loop generating each column name for the second half of the bind_param() function, but I'm going to need my foreach loop to also generate whether it's a string, integer, decemal etc.
Is there a function where I check the variable itself to see what type it is? And therefore check if it's either s,d,i or b. Then I can generate a string of letters for the first half of the bind_param() function.
It's the most annoying part of MySQLi, this variable type setting!
* EDIT * This chap believes setting always to string ('s') works and letting the behind the scenes do the work? https://stackoverflow.com/a/14370546/900559