これを送信しようとすると、次のエラーが表示される理由は誰にも見えますか?私は全体のヌル対アイテムを知っていますが、私はこれを引き起こしているべきではありません。どんな助けも素晴らしいだろうので、mySQLには新しくありません。sql '整数値が正しくありません'メッセージ
誤った整数値は=「」列に「2」の行で1
<?php
$db_host = "localhost";
$db_username = "TEST";
$db_pass = "example";
$db_name = "questions";
@mysql_connect("$db_host","$db_username","$db_pass") or die ("Could not connect to MySQL");
@mysql_select_db("$db_name") or die ("No database");
if ($_POST['parse_var'] == "contactform"){
$oneField = $_POST['one'];
$twoField = $_POST['two'];
$threeField = $_POST['three'];
$noneField = $_POST['none'];
$surveyField = $_POST['survey'];
$questionField = $_POST['questions'];
$guestField = $_POST['guest'];
$homeField = $_POST['home'];
$selected_radio = $_POST['radio'];
if ($selected_radio == 'one')
{
$oneField = '1';
}
else if ($selected_radio == 'two')
{
$twoField = '1';
}
else if ($selected_radio == 'three')
{
$threeField = '1';
}
else if ($selected_radio == 'none')
{
$noneField = '1';
}
if($surveyField == "yes"){
$surveyField = "1";
}
if($mysqlField == "yes"){
$mysqlField = "1";
}
if($guestbookField == "yes"){
$guestbookField = "1";
}
if($homeField == "yes"){
$homeField = "1";
}
$sqlUpdate = mysql_query("INSERT INTO questiondata (one, two, three, none, survey,
question, guest, home)
VALUES ('$oneField','$twoField','$threeField','$noneField','$surveyField','$questionField','$guestField','$homeField')")
or die (mysql_error());
}
?>
試して:
ので、空の変数が初期化されますあなたのコードを変更します。 – nabuchodonossor