I am trying to save data into a database using PDO. All columns save correctly with the exception of one. No matter what I try, I cannot get the data to go in.
myfunc($db, $data) {
echo $data; // <----- Outputs my data. example: 'jim jones'
$stmt = $db->prepare("CALL test(:id, :data, :ip, :expires)");
$stmt->bindParam(':id', $id, PDO::PARAM_STR);
$stmt->bindParam(':data', $data, PDO::PARAM_STR);
$stmt->bindParam(':ip', $ip, PDO::PARAM_STR);
$stmt->bindParam(':expires', $expires, PDO::PARAM_STR);
...
}
So even after verifying that the data variable in fact holds my data, the bindParam method will not bind.
When I echo the data variable, I can see the data is there. It will not save though. If I copy the echo'd output of the data variable to screen and paste it into a new variable, it WILL save.
I'm at this now for a couple of hours. Can someone please have a look?
EDIT:
I want to also mention that I have tried using bindValue() in place of bindParam() and the data for the data variable will still not save.