I have a simple query that selects a PIN from a list of numbers, and then assigns that PIN to a user and inserts it into another table:
$sth = $this->db->query("SELECT available_pins FROM pin_list ORDER BY RAND() LIMIT 0,1 ;");
$pinarray = $sth->fetch();
$this->user_pin = $pinarray;
$sth = $this->db->prepare("INSERT INTO users (user_email, user_pin) VALUES(:user_email, :user_pin) ;");
$sth->execute(array(':user_email' => $this->user_email, ':user_pin' => $this->user_pin));
However, this creates a Catchable fatal error: Object of class stdClass could not be converted to string, any ideas?
Additional info
$sth->execute(array gives the error, available_pins uses mediumint(6). It is a list of random 6 digit numbers.