1

The following code is trying to update a column itself by multiplying by an input variable:

$multiplier = $request->input("disc");

DB::statement('SET entries UPDATE dp = dp * :multiplier', array('multiplier' => $multiplier));

When I run this I get an error regarding my syntax.

I used https://fideloper.com/laravel-raw-queries to try and create my query.

2
  • Not an sql expert, but have you tried without SET entries? What is this supposed to do? Commented Jun 1, 2020 at 14:51
  • "I get an error" - which is? Please always include full quotes of errors in your questions. Commented Jun 1, 2020 at 14:55

1 Answer 1

1

The query syntax is wrong, please check for the correct (assuming it is mysql) one

$multiplier = $request->input("disc");

DB::statement('UPDATE entries SET dp = dp * :multiplier', ['multiplier' => $multiplier]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.