dongpin1059 2015-05-06 18:29
浏览 51

查询MySql服务器,Windows 2008 R2时出错

I have a system consisting of a web form & Mysql server running on 2008 R2. I have installed MySql & pma without any issue and verified that they are working and accessible. I have created this system on a development machine and everything runs well. Now that I moved the files to a live server I receive the following error message “localhost via TCP/IP string(61) "Incorrect decimal value: '' for column 'desiccant_1' at row 1"

Does anyone have a solution to this error? Thank you for your time. I have included all files, if more info is required please let me know.

Database name is comms.

Web form:

<body>
 <p>Complete form and submit:</p>
<form class="form" method="post" action="ealwReport.php">
<label for="desiccant_1">desiccant_1</label>
<input type="number"step="0.01" name="desiccant_1" min="0" max="16.5" /><br />
<label for="desiccant_2">desiccant_2</label>
<input type="number"step="0.01" name="desiccant_2" min="0" max="16.5" /><br />
<label for="desiccant_3">desiccant_3</label>
<input type="number"step="0.01" name="desiccant_3" min="0" max="16.5" /><br />
<label for="desiccant_4">desiccant_4</label>
<input type="number"step="0.01" name="desiccant_4" min="0" max="16.5" /><br />
<label for="desiccant_5">desiccant_5</label>
<input type="number"step="0.01" name="desiccant_5" min="0" max="16.5" /><br />
<label for="desiccant_6">desiccant_6</label>
<input type="number"step="0.01" name="desiccant_6" min="0" max="16.5" /><br />
<br />
<label for="laser_1">laser_1</label>
<input type="number"step="0.01" name="laser_1" min="0" max="16.5" /><br />
<label for="laser_2">laser_2</label>
<input type="number"step="0.01" name="laser_2" min="0" max="16.5" /><br />
<label for="laser_3">laser_3</label>
<input type="number"step="0.01" name="laser_3" min="0" max="16.5" /><br />
<label for="laser_4">laser_4</label>
<input type="number"step="0.01" name="laser_4" min="0" max="16.5" /><br />
<label for="laser_5">laser_5</label>
<input type="number"step="0.01" name="laser_5" min="0" max="16.5" /><br />
<label for="laser_6">laser_6</label>
<input type="number"step="0.01" name="laser_6" min="0" max="16.5" /><br />
<br />
<label for="table_top_1">table_top_1</label>
<input type="number"step="0.01" name="table_top_1" min="0" max="16.5" /><br />
<label for="table_top_2">table_top_2</label>
<input type="number"step="0.01" name="table_top_2" min="0" max="16.5" /><br />
<br />
<label for="RMI">RMI</label>
<input type="number"step="0.01" name="RMI" min="0" max="16.5" /><br />
<label for="Miscellaneous">Miscellaneous</label>
<input type="number"step="0.01" name="Miscellaneous" /><br />
<br />
<label for="User">User</label>
<input type="text" name="User" /><br />
<label for="Date">Date</label>
<input input type="text" name="Date" value="<?php echo date('F j, Y, G:i');?>" readonly/><br />

<label for="comments">Comments?</label>
<textarea class="text" name="comments"></textarea><br />
<br />
<input type="submit" class="submit" value="submit" name="submit" />
</form>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Date();
</script>
</body>

Web form posted to the following script “ealwReport.php”:

<?php
$desiccant_1 = $_POST['desiccant_1'];
$desiccant_2 = $_POST['desiccant_2'];
$desiccant_3 = $_POST['desiccant_3'];
$desiccant_4 = $_POST['desiccant_4'];
$desiccant_5 = $_POST['desiccant_5'];
$desiccant_6 = $_POST['desiccant_6'];
$laser_1 = $_POST['laser_1'];
$laser_2 = $_POST['laser_2'];
$laser_3 = $_POST['laser_3'];
$laser_4 = $_POST['laser_4'];
$laser_5 = $_POST['laser_5'];
$laser_6 = $_POST['laser_6'];
$table_top_1 = $_POST['table_top_1'];
$table_top_2 = $_POST['table_top_2'];
$RMI = $_POST['RMI'];
$Miscellaneous = $_POST['Miscellaneous'];
$User = $_POST['User'];
$Date = $_POST['Date'];
$comments = $_POST['comments'];

$dbc = mysqli_connect('localhost', 'root', 'xxxxx', 'comms')
or die('Error connecting to MySQL server.');
echo mysqli_get_host_info($dbc) . "
";

Insert data into Database:

$query = "INSERT INTO ealw (desiccant_1, desiccant_2, desiccant_3, desiccant_4, " .
     "desiccant_5, desiccant_6, laser_1, laser_2, laser_3, laser_4, laser_5, " .
     "laser_6, table_top_1, table_top_2, RMI, Miscellaneous, User, Date, comments) " .
     "VALUES ('$desiccant_1', '$desiccant_2', '$desiccant_3', '$desiccant_4', '$desiccant_5', " .
     "'$desiccant_6', '$laser_1', '$laser_2', '$laser_3', '$laser_4','$laser_5', " .
     "'$laser_6', '$table_top_1','$table_top_2', '$RMI', " .
     "'$Miscellaneous', '$User', '$Date', '$comments')";
$result = mysqli_query($dbc, $query)
or die (var_dump(mysqli_error($dbc)));

ERROR RECEIVED = localhost via TCP/IP string(61) "Incorrect decimal value: '' for column 'desiccant_1' at row 1"

Return latest record from DB:

$sql2 = "SELECT desiccant_1, desiccant_2, desiccant_3, desiccant_4, desiccant_5
, desiccant_6, laser_1, laser_2, laser_3, laser_4, laser_5, laser_6
, table_top_1, table_top_2, RMI, Miscellaneous FROM ealw ORDER BY id DESC     LIMIT 1";
$result2 = mysqli_query($dbc, $sql2);
?>

Table structure:

CREATE TABLE IF NOT EXISTS `ealw` (
 `id` int(11) NOT NULL,
 `desiccant_1` decimal(4,2) NOT NULL DEFAULT '0.00',
 `desiccant_2` decimal(4,2) NOT NULL DEFAULT '0.00',
 `desiccant_3` decimal(4,2) NOT NULL DEFAULT '0.00',
 `desiccant_4` decimal(4,2) NOT NULL DEFAULT '0.00',
 `desiccant_5` decimal(4,2) NOT NULL DEFAULT '0.00',
 `desiccant_6` decimal(4,2) NOT NULL DEFAULT '0.00',
 `laser_1` decimal(4,2) NOT NULL DEFAULT '0.00',
 `laser_2` decimal(4,2) NOT NULL DEFAULT '0.00',
 `laser_3` decimal(4,2) NOT NULL DEFAULT '0.00',
 `laser_4` decimal(4,2) NOT NULL DEFAULT '0.00',
 `laser_5` decimal(4,2) NOT NULL DEFAULT '0.00',
 `laser_6` decimal(4,2) NOT NULL DEFAULT '0.00',
 `table_top_1` decimal(4,2) NOT NULL DEFAULT '0.00',
 `table_top_2` decimal(4,2) NOT NULL DEFAULT '0.00',
 `RMI` decimal(4,2) NOT NULL DEFAULT '0.00',
 `Miscellaneous` decimal(4,2) NOT NULL DEFAULT '0.00',
 `User` text NOT NULL,
 `Date` text NOT NULL,
 `comments` text
 ) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=latin1;
  • 写回答

1条回答 默认 最新

  • dongxi1680 2015-05-07 19:06
    关注

    Thanks to everyone for their input. My problem was solved by disabling 'strict' mode in the Mysql DB as suggested by Kenny. I used PMA & entered - SET @@global.sql_mode= ''; to turn off strict mode.The system is now working as expected.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度