if($inserted=mysqli_affected_rows($conn))
{
$a=mysqli_query($conn,"select * from c_agent where fps_name='$shop_name'");
if (mysqli_num_rows($a)>0)
{
$b=mysqli_fetch_assoc($a);
$sh_id=$b['fps_id'];
}
}
$ss=(string)($sh_id);
$ins="Create table $ss("
."'aadhar_id' int not null ,"
."'name' varchar(10),"
."'wheat' int,"
."'rice' int,"
."'kerosine'int"
. " )"
. " ENGINE = InnoDB;";
if(mysqli_query($conn,$ins))
{
echo "Table created successfully";
} else
{
echo "ERROR: Could not able to execute ". mysqli_error($conn). mysqli_errno($conn);
}
所以基本上我想用变量创建一个表,它显示我下面的错误。数据已成功插入变量$sh_id
。但我仍然无法使用变量名创建表。
错误:无法执行您的SQL语法有错误;查看与您的MariaDB服务器版本对应的手册,以便在#104; 1047附近使用正确的语法(' aadhar_id' int not null,' name' varchar(10),&# 39;小麦' int,'大米' int,' kerosi'在11064行