[insert_php]

global $wpdb;
$sql = “SELECT question, booked_time, email FROM qt1ltt_cpabc_appointments ORDER BY ID DESC LIMIT 1″;
$results = $wpdb->get_results($sql); // return result of pre-written messages
if ($results) {
foreach ($results as $row) {
$details= $row->question;
$booked_time=$row->booked_time;

$email=$row->email;

}
}
$str=”

Report Booking Confirmation with Dr Eve Pearce

“;
$str.=”The following booking has been made by you. The booking has been emailed to “.$email.”

“;
$str.=$details;
$str.=”

Date and time: “.$booked_time;
echo $str;

[/insert_php]