我有一个 php 标签,我也尝试从数据库中检索以获取一些值。然后将这些值声明给变量,然后使用这些变量将值传递给 html body 标签。
PHP:
<?php
$sql = "SELECT * FROM productItem;";
// Write a statement to open a connection to MySQL server
$link = mysql_connect("localhost:3306", "root", "6i7yvBku");
// Write a statement to select the required database
mysql_select_db("KXCLUSIVE", $link);
// Write a statement to send the SQL statement to the MySQL server for execution and retrieve the resultset
$resultset = mysql_query($sql);
// Write a statement to close the connection
mysql_close($link);
$year = $row["year"];
$month = $row["month"];
?>
HTML:
<body onload="countdown(year,month)">
我应该如何将 php 变量($year 和 $month)放入 html body 标签中(替换 body 标签中的 year 和 month 变量??