Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLSTATE[01000]: Warning: 1265 Data truncated for column

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'pay_totals' at row 1

public function order(Request $req){
        $order = new Order;
        $order->pay_number = $req->checkout_number;
        $order->pay_totals = $req->checkout_total;
        $order->save();
        return redirect(route('pay'))->with('message','Sending infomation successfully');
    }

blade:

<input type="text" name="checkout_total" value="{{Cart::subTotal('0') }} ">

Helppp

like image 612
Honda hoda Avatar asked Dec 28 '17 03:12

Honda hoda


People also ask

How do I fix error 1265 in MySQL?

First, check if the data type of the column is right for the input data. Maybe its defined length is smaller than it should be, or maybe there's a misalignment that resulted in a value trying to be stored in a field with different datatype.

What does data truncated for column mean?

Truncated means “cut short”, and “data truncated” warnings or errors refer to a value's data being cut off at the end during the importing process (e.g. a value of “2.9823” being imported as “2.98”). These errors are important warnings, because it notifies us that our data has not been imported accurately.

What is data truncated in MySQL?

The TRUNCATE statement in MySQL removes the complete data without removing its structure. It is a part of DDL or data definition language command. Generally, we use this command when we want to delete an entire data from a table without removing the table structure.


1 Answers

The problem is that column pay_totals can't store whatever you are getting from the input because is too big.

Possibles solutions

SQL: ALTER TABLE [orders] ALTER COLUMN [pay_totals] VARCHAR(MAX)

MYSQL: ALTER TABLE [orders] MODIFY COLUMN [pay_totals] VARCHAR(60000)

like image 63
Luis felipe De jesus Munoz Avatar answered Sep 28 '22 05:09

Luis felipe De jesus Munoz