0

When I try to enter some very long data, (response from ChatGPT API) it doesn't get saved into sessions data which Im handling manually by storing in a MySQL table.

$_SESSION[$propertyName."-".$ID] = addslashes($propertyValue);
Uncaught mysqli_sql_exception: Data too long for column 'Data' at row 1

Data is of Type text latin1_swedish_ci

I thought type of text can handle large amounts of data.

3
  • What is Data column datatype precisely? What is the length of the data to be stored in this column?
    – Akina
    Nov 5 at 21:12
  • The TEXT data type can handle string data that is somewhat long, but not unlimited. The limit for that data type is 64KB (i.e. a string whose length can be encoded in 16 bits). If your ChatGPT response is longer than that, it won't fit in a TEXT column. Nov 6 at 3:37
  • I changed it to LONGTEXT - it seems to be okay now.
    – anjanesh
    Nov 6 at 23:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.