My question is simple.. When using bind_param with mysqli extension, you have telling mysqli whether it is a string, integer, double, or blob.
My issue is I am using an API to retrieve data back from a service. Sometimes I have an issue where the data expected would be an integer (but there is nothing, so it's NULL) which causes an error.
Which way should I pursue the issue:
tell msyqli they are all strings and allow the null value
cycle through each variable that would potentially be an integer and if it is null set it to 0.
An example of my query is as follows:
$stmt->bind_param("issssssisisiiiissssssssiiiiisis", $MLSNumber, $ListPrice, $this->propertyType, $ListingStatus, $this->newAddress, $City, $State, $PostalCode, $SchoolDistrict, $YearBuilt, $AcresApx, $TotalRooms, $Bedrooms, $BathsFull, $BathsHalf, $PublicRemarks, $remark, $remark, $remark, $remark, $remark, $remark, $remark, $ListAgentID, $ListAgentID, $ListOfficeID, $ListAgentID, $ListOfficeID, $this->retsUpdatedDateTime, $ListingID, $this->retsPhotosUpdatedDateTime);
The problem is, like I stated, I cannot be 100% sure that the values returned will be there. If they are, they will always be the correct format (string or int) otherwise, they are NULL.
Thanks for the input.