i am running this PDO Query in PHP:
$stmt = $pdo_conn->prepare("SELECT * from contacts where email = :email ");
$stmt->execute(array(':email' => $from ));
$contact = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($contact) > 0) {
echo $contact["email"];
}
but its not echoing the email column from the contacts table
i know there is defiantly a value there as if i do echo 'yes'; inside the if statement it shows
what have i done wrong here?
var_dump($contact); shows
array(1) { [0]=> array(22) { ["sequence"]=> string(3) "266" ["newsletter"]=> string(3) "yes" ["company_sequence"]=> string(3) "278" ["title"]=> string(2) "Mr" ["forename"]=> string(7) "Forename" ["surname"]=> string(4) "Surname" ["email"]=> string(22) "[email protected]" ["password"]=> string(32) "**********" ["phone"]=> string(0) "" ["mobile"]=> string(11) "00000000000" ["notes"]=> string(0) "" ["contactstatus"]=> string(0) "" ["logintries"]=> string(1) "0" ["dob"]=> string(10) "0000-00-00" ["receive_allticketupdates"]=> string(3) "yes" ["receive_accountsemails"]=> string(3) "yes" ["can_edit_contacts"]=> string(3) "yes" ["view_all_tickets"]=> string(3) "yes" ["receive_orderemails"]=> string(0) "" ["can_login_online"]=> string(3) "yes" ["last_satisfaction_survey_received"]=> string(10) "0000-00-00" ["receive_domainemails"]=> string(0) "" } }
var_dump($contact);after your::fetchAll(). This will help us see where the problem may be.var_dump($contact)?