Her er et eksempel på en kode:
$headers = 'From: [email protected]' . "\r\n";
$mysqli = new mysqli("localhost", "user", "password", "database");
$output = $mysqli->prepare("SELECT id FROM table WHERE x=?");
$output->bind_param("s", $parameter);
$output->execute();
$output->store_result();
$output->bind_result($id);
while ($output->fetch())
{
mail($to, $subject, $emailcontent, $additionalheader);
}
$output->close();
Tag et kig på disse links:
1. http://php.net/manual/de/mysqli.quickstart .prepared-statements.php
2. http://us3.php.net/manual/de/book.mail .php