phpphp-8.3mariadb-11

Uncaught mysqli_sql_exception: Incorrect integer value:


This is an error after changing to php8.3 and MariaDB 11.3. Where did I go wrong? Please take a look.

echo "$_SESSION[Iyagi_Id]','$today','$img','$title','$weath','$mood1','$mood2','$happy','$love','$c[web_edit]','$text";

The input values are as follows. 1111','2024-5-15','','This is the title.','','','','','','','This is the content.

Maria DB (11.3) Query (line 72)

mysqli_query($connect , "insert into hani_diary (id,day,img,title,weath,mood1,mood2,happy,love,html,text) values('$_SESSION[Iyagi_Id]','$today','$img','$title','$weath','$mood1','$mood2','$happy','$love','$c[web_edit]','".mysqli_real_escape_string($connect, $text)."')") or die("입력 에러");
js_move("./memo_write.php?year=$year&month=$month&day=$day");

Error message

Fatal error: Uncaught mysqli_sql_exception: Incorrect integer value: '' for column gagebu.hani_diary.happy at row 1 in /home/gagebu/www/memo/memo_write.php:72 Stack trace: #0 /home/gagebu/www/memo/memo_write.php(72): mysqli_query() #1 {main} thrown in /home/gagebu/www/memo/memo_write.php on line 72

I am trying to insert data into Maria DB.


Solution

  • You are inserting a record, and trying to set the field happy to a value of an empty string, or "".

    But in your Maria DB table hani_diary, the field happy is configured to be an integer.

    Either change the configuration of your table to something capable of holding text (for example, text), or make sure your variable $happy holds an integer.