我有这段代码可以连接到 mysql 并从一个表中获取数据:
<?php
//Include database connection details
require_once('sql/config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
$result = mysql_query("SELECT * FROM customers");
while($row = mysql_fetch_array($result)) {
echo $row['email'];
echo "<br />";
}
mysql_close($link);
?>
现在我怎样才能将这个电子邮件数据从 mysql 填充到以前安全地创建的表单中?