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
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.
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.
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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With