我有这个代码来创建一个基于随机数的数据库。
<?php
$con = mysql_connect("localhost","soociali","[censored]");
$databasename = rand(5, 7);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE $databasename",$con))
{
echo "Database created, called $databasename";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>
但是,我收到此错误:Error creating database: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6' at line 1