how to update column with null value?

Marc

As i update column with null value, it gives me an error like this:

SQLSTATE[42S22]: Column not found: 1054 Unknown column '00:00:00' in 'field list' (SQL: update attendances set 00:00:00 = 12:11:45 where (studentid = 4 and date = 2018-07-09))

query

DB::table('attendances')
    ->where(['studentid' => $singleData['id'], 'date' => $date])
    ->update([$data['out_am'] => $time]);

my controller

[Image]

DigitalDrifter

You are using a value as a field name. It should probably be something like this:

DB::table('attendances')
    ->where(['studentid' => $singleData['id'], 'date' => $date])
    ->update(['out_am' => $data['out_am']]);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to update column with null value

how can update the value of null column in rails

oracle: update a column with not null value

How to run an UPDATE script in postgresql only if column value is NOT NULL?

How to update only first NULL column with a value in Snowflake sql?

How to update a column with INSERT ... ON CONFLICT only if the old value is NULL

How to update value to the column?

Optional column update if provided value for column is not null

Update null values by value in same column

mysql update column to null or its value

Update JSONB column with NULL value in PostgreSQL

Only update column if input value is not null

Update a column when value is not null JOOQ

How to UPDATE a column in a table if the column is not NULL?

Update Column value for all rows in Table where Column Value Is Null?

How to .update() value to NULL in sequelize

How to update column value in laravel

How to update value within a column?

How to update a column using another column value?

How to achieve default value if column value is NULL?

How update the column value depending on the value of other column by procedure?

How do I update a column only if a different column's value is false, null or doesn't match the incoming value and the incoming value is set to true?

How to pass a null value in the clancats hydrahon update()?

How to pass NULL value in fetch to backend for update?

How to update value to null using FluentMigrator

How to ignore update or insert join if NULL value

Mysql - Update first row in table where a column has a null value

Update null value on existing column/tables using aggregation

Column lost their value and turned into null after using update function