我正在构建一个 Web 应用程序,其中用户填写一个 html 表单,捕获的信息用于创建一个包含相应列的表。但是,mysql 返回一个错误,其中 POST 变量用于命名列。这是代码示例:
$questionnaire = mysql_real_escape_string(htmlentities($_POST['questionnaire']));
$question = mysql_real_escape_string(htmlentities($_POST['question']));
$answer1 = mysql_real_escape_string(htmlentities($_POST['answer1']));
$answer2 = mysql_real_escape_string(htmlentities($_POST['answer2']));
mysql_query = "CREATE TABLE $questionnaire
(id int(5) NOT NULL AUTO INCREMENT,
PRIMARY KEY(id),
question varchar(200),
'$answer1' varchar(200),
'$answer2' varchar(200) )";
如何使值$answer1
用于给列命名?