Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

have you debug / print the query built from your Query Builder ? and paste it here

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

i have similar problem, any help and solution would be nice :)

Last updated 2 years ago.
0

look at http://laravel.com/docs/queries#updates

ps why do you need concat? you have to power of PHP

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

SGehly1 sgehly1 Joined 18 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.