have you debug / print the query built from your Query Builder ? and paste it here
Try:
DB::table('groups')
->where('code', '=', $code)
->set('members', DB::raw('concat(members, '.$userId.')'))
->update();
I recommend always using the 3 argument version of the where() method variants and placing each method on a new line for readability, indenting only once where appropriate.
Hi Shawn, thanks for the help! One more issue. I am now using:
DB::table('groups')
->where('code', '=', Input::get('code'))
->set('members', DB::raw('concat(members, '.Auth::user()->id.')'))
->update();
and get "Call to undefined method Illuminate\Database\Query\Builder::set()"
if (starts_with($method, 'where'))
{
return $this->dynamicWhere($method, $parameters);
}
$className = get_class($this);
throw new \BadMethodCallException("Call to undefined method {$className}::{$method}()");
}
Is there a way to include this method (I dont seem to see a set method, perhaps I'm looking in the wrong place) or another method all together?
i have similar problem, any help and solution would be nice :)
look at http://laravel.com/docs/queries#updates
ps why do you need concat
? you have to power of PHP
solution for this problem: http://stackoverflow.com/questions/22098600/laravel-4-concat-issues
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community