このように設定されたデータベースにデータを挿入したい
テーブル
- 名前 varchar(35)
- 部門 varchar(50)
- 評価 smallint(6)
- 容易さ smallint(6)
- 教科書 varchar(3)
- タイムスタンプ タイムスタンプ
- コース char(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);
}