Mysql
 sql >> Database >  >> RDS >> Mysql

come recuperare i dati dal database mysql usando php

Ecco un codice di esempio:

$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();

Dai un'occhiata a questi link:
1. http://php.net/manual/de/mysqli.quickstart .preparate-statements.php
2. http://us3.php.net/manual/de/book.mail .php