The following code is a section of one of my classes:
$stmt = $this->dbh->prepare("SELECT t_id FROM checkOut WHERE t_id = :param1"); $stmt->bindParam(':param1', $this->numberIn); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); var_dump($result); $this->p_id = $result['p_id']; My original issue was that php was stating that p_id was an undefined index. To figure out what was going on, I threw in var_dump to see what was in the array. For some reason, it contained only one value, 4 which corresponded to the first column's name, t_id. My MySQL table has four columns, and I need all four to be present in the array. Why would my code only be grabbing the first column's value?
Any help would be appreciated.