sqlstate[22007]:无效的日期时间格式:1366不正确的整数值:第1行“exercise\u type”列的“walking”
public function up()
{
Schema::table('diabetic_records', function (Blueprint $table) {
$table->unsignedInteger('user_id')->nullable()->after('id');
$table->decimal('glucose_level',5,2)->nullable()->after('user_id');
$table->string('glucose_level_time')->nullable()->after('glucose_level');
$table->string('food_name')->nullable()->after('glucose_level_time');
$table->integer('food_amount')->nullable()->after('food_name');
$table->string('treatment')->nullable()->after('food_amount');
$table->string('medication_name')->nullable()->after('treatment');
$table->decimal('medication_dose',6,2)->nullable()->after('medication_name');
$table->string('medication_time')->nullable()->after('medication_dose');
$table->integer('excercise_type')->nullable()->after('medication_time');
$table->integer('excercise_duration')->nullable()->after('excercise_type');
});
}
2条答案
按热度按时间esyap4oy1#
我只是通过问我哥哥这个问题找到了解决这个问题的办法。首先,我练习的数据类型是int,我在其中输入字符(字符串)。
查看:
在解决错误之前,我键入的代码如下所示
现在让我们开始解决这个错误的一部分
1) 首先,给视图中selecttag下的选项赋值,比如1,2,3。
2) 只需转到config文件夹并创建一个名为constant.php的文件。
3) 现在返回一个数组,写下输入字段的名称,并将选项字段的值赋给它们,您在视图中这样写。
?>
我希望你能得到帮助。
niwlg2el2#
的数据类型
excercise_type
在数据库中必须设置为datetime。将其更改为int(11)。并且值必须是整数,而不是字符串,即walking。那也许能解决你的问题。