mysql - php mail with variables -
i attempting setup mail script first run simple select mysql, , use these array variables in message. variables not output message body, 1 row of variables. here script:
$sql1 = "select * videos checked_out = '1'"; $result1 = $dblink->query($sql1); while($row1 = $result1->fetch_assoc()) { $name = $row1['name']; $tape_no = $row1['tape_no']; $member_name = $row1['member_name']; $date_out = date("f j, y", strtotime($row1['date_out'])); } //email function administrator $to = "nouser@mail.com"; $subject = "daily video rental summary"; $message = "$name $tape_no $date_out $member_name ====================================================================== please not reply message, mailbox not monitored ======================================================================"; $from = "no_replies_please@mail.com"; $headers = "from:" . $from; mail($to,$subject,$message,$headers);
appreciate insight cares share on this. thanks, --matt
try instead:
$sql1 = "select * videos checked_out = '1'"; $result1 = $dblink - > query($sql1); while ($row1 = $result1 - > fetch_assoc()) { $name = $row1['name']; $tape_no = $row1['tape_no']; $member_name = $row1['member_name']; $date_out = date("f j, y", strtotime($row1['date_out'])); //email function administrator $to = "nouser@mail.com"; $subject = "daily video rental summary"; $message = "$name $tape_no $date_out $member_name ====================================================================== please not reply message, mailbox not monitored ======================================================================"; $from = "no_replies_please@mail.com"; $headers = "from:".$from; mail($to, $subject, $message, $headers); }
Comments
Post a Comment