SA__
SA__

Reputation: 1862

Simple Update Query Not working - MySQL

Here is my Update Query in Laravel

$do = DB::table('pipo_orders')
            ->where('id', 1)
            ->update(array('clientcopyimage' => 1));

The Table name is pipo_orders while i execute the query no change is happening to that particular coloumn.

Is there any basic mistake in the Query

Here is the Documentation i followed.

Upvotes: 0

Views: 131

Answers (3)

Raffy Cortez
Raffy Cortez

Reputation: 448

Please check your where chain method

should have equal sign '=',

$do = DB::table('pipo_orders')
        ->where('id','=',1)
        ->update(array('clientcopyimage' => 1));

Upvotes: 0

Girish
Girish

Reputation: 12127

If field data type varchar or enum then need to quote input value.

->update(array('clientcopyimage' => "1"));

otherwise Library will behave input value as numeric.

Upvotes: 0

Sulthan Allaudeen
Sulthan Allaudeen

Reputation: 11320

As you said the datatype for clientcopyimage is varchar, then you should quote your value like Girish said

$do = DB::table('pipo_orders')
            ->where('id', 1)
            ->update(array('clientcopyimage' => "1"));

Upvotes: 1

Related Questions