mysql创建当前年月如(2014-11)作为表名的代码
发布网友
发布时间:2022-04-08 09:18
我来回答
共1个回答
热心网友
时间:2022-04-08 10:47
<?php
$con = mysql_connect("localhost","username","pwd");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_query("use dbname",$con));
$tbname = date('Y-m',time());
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE $tbname (FirstName varchar(15),LastName varchar(15),Age int)";
mysql_query($sql,$con);
mysql_close($con);
?>
试试上面的代码