我想将数据插入这样设置的数据库中
桌子
- 名称 varchar(35)
- 部门 varchar(50)
- 评分 smallint(6)
- 容易小int(6)
- 教科书 varchar(3)
- 时间戳时间戳
- 课程字符(10)
- 曲线字符(3)
- 评论文字
我用下面这样的查询插入数据,它实际上并没有插入数据库,页面重新加载,就是这样。这是 和 的print_r()
结果var_dump()
。实际查询功能如下。可能是什么问题?我认为它可能是某种文本类型溢出。但是我想不通,谢谢你的帮助
print_r()
结果:
insert into professor(name,department,rating,easiness,textbook,course,curve,comment)values('Cherry, Mark','HUMANITIES','8','8','yes','PHIL 3311','no','Go to class. He doesn't require it but it will make the difference between an A or a B. It's very difficult to do anything without being in class. He gives all the answers you need so long as you show up. He's a very good teacher and I would recommend him to someone else')
var_dump()
结果:
string(424) "insert into professor(name,department,rating,easiness,textbook,course,curve,comment)values('Cherry, Mark','HUMANITIES','8','8','yes','PHIL 3311','no','Go to class. He doesn't require it but it will make the difference between an A or a B. It's very difficult to do anything without being in class. He gives all the answers you need so long as you show up. He's a very good teacher and I would recommend him to someone else')" bool(false)
这是我的代码:
function processadd()
{
$name =htmlentities($_POST['prof']);
$department =htmlentities($_POST['depart']);
$rating =htmlentities($_POST['Rating']);
$easy=htmlentities($_POST['Easiness']);
$textbook =htmlentities($_POST['Book']);
$course =htmlentities($_POST['course']);
$curve =htmlentities($_POST['curve']);
$comment =htmlentities($_POST['comment']);
if($course == "" || $comment == "")
{
print"<div class=error><h3> Empty Fields exist!, please fill out completely</h3></div>";
}
else
{
$db = adodbConnect();
$query = "insert into professor(name,department,rating,easiness,textbook,course,curve,comment)values('$name','$department','$rating','$easy','$textbook','$course','$curve','$comment')";
$result = $db -> Execute($query);
}
print_r($query);
print_r($result);
print"<br>";
print"<br>";
print"<br>";
var_dump($query);
var_dump($result);
}